From ee8419701472be9f24c51a41ee7b7ef3cf38f329 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Wed, 29 Aug 2018 01:51:25 +0100 Subject: Force all headers other than "Globals.h" to be included with relative paths (#4269) Closes #4236 CMake now creates a header file in the build directory under the path "include/Globals.h" which just includes "src/Globals.h" with an absolute path. Then instead of adding "src/" to the include directories, it adds "include/". #include "Globals.h" still works by including the build generated file and any other src-relative path will not work. --- src/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 642bc81a3..e895b1657 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -159,7 +159,10 @@ SET (HDRS XMLParser.h ) -include_directories(".") +file(WRITE "${CMAKE_BINARY_DIR}/include/Globals.h" + "/* This file allows Globals.h to be included with an absolute path */\n#include \"${PROJECT_SOURCE_DIR}/Globals.h\"\n") + +include_directories("${CMAKE_BINARY_DIR}/include") include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/sqlite") include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/SQLiteCpp/include") include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/TCLAP/include") @@ -245,8 +248,6 @@ else () includefolder("Resources") source_group("" FILES ${SOURCE}) - include_directories("${PROJECT_SOURCE_DIR}") - # Precompiled headers (1st part) SET_SOURCE_FILES_PROPERTIES( Globals.cpp PROPERTIES COMPILE_FLAGS "/Yc\"Globals.h\"" -- cgit v1.2.3