diff options
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | Makefile.in | 10 | ||||
-rw-r--r-- | src/mmo/version.cpp | 2 | ||||
-rw-r--r-- | src/shared/lib.cpp | 2 |
4 files changed, 12 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d5e9d1..d997b98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,13 +101,14 @@ set(PACKAGEDATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/tmwa") set(LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}") set(SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}") -# Generate the install.hpp and version.hpp files in the source directory. -# TODO: Is there a nicer way to handle this so we're still able to make fully -# out-of-tree builds, generating the files in the build directory, but still -# having them found by includes? -configure_file(src/conf/install.hpp.in ${CMAKE_SOURCE_DIR}/src/conf/install.hpp @ONLY) -configure_file(src/conf/version.hpp.in ${CMAKE_SOURCE_DIR}/src/conf/version.hpp @ONLY) +# Generate the install.hpp and version.hpp files. +configure_file(src/conf/install.hpp.in src/conf/install.hpp @ONLY) +configure_file(src/conf/version.hpp.in src/conf/version.hpp @ONLY) set(conf_SOURCES ${conf_SOURCES} src/conf/install.hpp src/conf/version.hpp) +# And have the build search for files in the build directory. +# Note that #includes with generated files should use a path relative to the +# top level source or build directory. +include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Add a shared library: libtmwa-shared.so.0 # When we add_executable later, we need to link against this library. diff --git a/Makefile.in b/Makefile.in index d4334eb..2f62baf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -488,12 +488,8 @@ obj/%.d: src/%.cpp | stamp/generated.stamp -MF $@ $< # -MG takes the include parameter as-is without prepending the path whenever # it's not found, and presumed to be a not-yet generated file. -# This is troublesome, since real.make tends not to be in the same directory. -# We work around this by checking to see if a file doesn't exist, and if it -# doesn't, we prepend the path. - for f in $$(sed -e '1s@$(patsubst obj/%.d,%,$@) := \(.*\)@\1@' $@ | tr ' ' \\n | grep -vFx -e : -e \\); do \ - test -f "$${f}" || sed -i "s|\($${f}\)|src/$(dir $*)\1|" $@; \ - done +# #include statements for generated files should always be relative to the +# source (or build) directory. endif # the above SRC_DIR replacement is not really safe, but it works okayish. obj/%.ii: src/%.cpp @@ -742,7 +738,7 @@ conf-raw/str-%.h: FORCE FORCE:: ; .PHONY: FORCE -override CPPFLAGS += -I . -I ${SRC_DIR}/include +override CPPFLAGS += -I. -I${SRC_DIR}/include # distribution tarballs # this only works from within a git checkout diff --git a/src/mmo/version.cpp b/src/mmo/version.cpp index f91b748..c75c25c 100644 --- a/src/mmo/version.cpp +++ b/src/mmo/version.cpp @@ -20,7 +20,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#include "../conf/version.hpp" +#include "src/conf/version.hpp" #include "../strings/xstring.hpp" diff --git a/src/shared/lib.cpp b/src/shared/lib.cpp index 0eebf17..563bff4 100644 --- a/src/shared/lib.cpp +++ b/src/shared/lib.cpp @@ -18,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#include "../conf/install.hpp" +#include "src/conf/install.hpp" #include "../strings/literal.hpp" #include "../strings/astring.hpp" |