diff options
author | Brad King <brad.king@kitware.com> | 2011-06-07 18:04:00 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-06-07 18:04:00 (GMT) |
commit | 313a633b85adcf6c69120dcec8e4685371549ce0 (patch) | |
tree | 9a0ff390eb5b517205acc16de88407d66eb13978 | |
parent | f0d36581025fb83c0cfdd7cf9ade28dd1de5f8ea (diff) | |
parent | 27aa446352b882c7bbda269a3770fec8fa24eb57 (diff) | |
download | CMake-313a633b85adcf6c69120dcec8e4685371549ce0.zip CMake-313a633b85adcf6c69120dcec8e4685371549ce0.tar.gz CMake-313a633b85adcf6c69120dcec8e4685371549ce0.tar.bz2 |
Merge topic 'vs10_include_fix'
27aa446 One more try. Use full path by default, and relative on broken compilers.
2dfc121 Use bin tree for inclues to avoid -I with spaces in the path.
6d29b4b Append and do not clobber CMAKE_CXX_FLAGS in the test.
7815e90 Fix for bug#10798. VS10 did not append -I flags with COMPILE_FLAGS prop.
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.cxx | 7 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/IncludeDirectories/CMakeLists.txt | 47 | ||||
-rw-r--r-- | Tests/IncludeDirectories/main.cpp | 9 |
4 files changed, 74 insertions, 1 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index ed0d60c..ae496ad 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -299,7 +299,12 @@ cmVisualStudioGeneratorOptions { fout << "<" << m->first << ">"; } - fout << m->second << "</" << m->first << ">\n"; + fout << m->second; + if (m->first == "AdditionalIncludeDirectories") + { + fout << ";%(AdditionalIncludeDirectories)"; + } + fout << "</" << m->first << ">\n"; } } else diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index e9aed16..bf08b52 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2043,6 +2043,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ADD_TEST_MACRO(CompileCommandOutput "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands") ENDIF() + + ADD_TEST(IncludeDirectories ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/IncludeDirectories" + "${CMake_BINARY_DIR}/Tests/IncludeDirectories" + --build-two-config + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project IncludeDirectories + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --test-command IncludeDirectories) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") + ENDIF(BUILD_TESTING) SUBDIRS(CMakeTests) diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt new file mode 100644 index 0000000..60b8c22 --- /dev/null +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required (VERSION 2.6) +project(IncludeDirectories) + +file(WRITE ${CMAKE_BINARY_DIR}/Flags/Flags.h +"//Flags.h +") +file(WRITE ${CMAKE_BINARY_DIR}/IncDir/IncDir.h +"//IncDir.h +") +file(WRITE ${CMAKE_BINARY_DIR}/SrcProp/SrcProp.h +"//SrcProp.h +") +file(WRITE ${CMAKE_BINARY_DIR}/TarProp/TarProp.h +"//TarProp.h +") + +# default to testing with full path +# some compilers can not handle the escape for directories +# with spaces in them. +set(USE_FULLPATH TRUE) +if(WATCOM OR MSVC60) + set(USE_FULLPATH FALSE) +endif() +if(USE_FULLPATH) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \"-I${CMAKE_BINARY_DIR}/Flags\"") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -IFlags") +endif() + +include_directories(${CMAKE_BINARY_DIR}/IncDir) +if(USE_FULLPATH) + set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS + "\"-I${CMAKE_BINARY_DIR}/SrcProp\"") +else() + set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS + "-ISrcProp") +endif() + +add_executable(IncludeDirectories main.cpp) + +if(USE_FULLPATH) + set_target_properties(IncludeDirectories + PROPERTIES COMPILE_FLAGS "\"-I${CMAKE_BINARY_DIR}/TarProp\"") +else() + set_target_properties(IncludeDirectories + PROPERTIES COMPILE_FLAGS "-ITarProp") +endif() diff --git a/Tests/IncludeDirectories/main.cpp b/Tests/IncludeDirectories/main.cpp new file mode 100644 index 0000000..a59d27c --- /dev/null +++ b/Tests/IncludeDirectories/main.cpp @@ -0,0 +1,9 @@ +#include "Flags.h" +#include "IncDir.h" +#include "SrcProp.h" +#include "TarProp.h" + +int main(int argc, char** argv) +{ + return 0; +} |