From 7815e90e21049cb06ecbdbe8ed44aa008aa9d6f4 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 2 Jun 2011 10:28:10 -0400 Subject: Fix for bug#10798. VS10 did not append -I flags with COMPILE_FLAGS prop. This fix adds a test for this case for all generators. --- Source/cmVisualStudioGeneratorOptions.cxx | 7 ++++++- Tests/CMakeLists.txt | 12 ++++++++++++ Tests/IncludeDirectories/CMakeLists.txt | 10 ++++++++++ Tests/IncludeDirectories/Flags/Flags.h | 1 + Tests/IncludeDirectories/IncDir/IncDir.h | 1 + Tests/IncludeDirectories/SrcProp/SrcProp.h | 1 + Tests/IncludeDirectories/TarProp/TarProp.h | 1 + Tests/IncludeDirectories/main.cpp | 9 +++++++++ 8 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Tests/IncludeDirectories/CMakeLists.txt create mode 100644 Tests/IncludeDirectories/Flags/Flags.h create mode 100644 Tests/IncludeDirectories/IncDir/IncDir.h create mode 100644 Tests/IncludeDirectories/SrcProp/SrcProp.h create mode 100644 Tests/IncludeDirectories/TarProp/TarProp.h create mode 100644 Tests/IncludeDirectories/main.cpp 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 << "first << ">\n"; + fout << m->second; + if (m->first == "AdditionalIncludeDirectories") + { + fout << ";%(AdditionalIncludeDirectories)"; + } + fout << "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..af2a2b7 --- /dev/null +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required (VERSION 2.6) +project(IncludeDirectories) + +set(CMAKE_CXX_FLAGS "\"-I${CMAKE_SOURCE_DIR}/Flags\"") +include_directories(${CMAKE_SOURCE_DIR}/IncDir) +set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS + "\"-I${CMAKE_SOURCE_DIR}/SrcProp\"") +add_executable(IncludeDirectories main.cpp) +set_target_properties(IncludeDirectories + PROPERTIES COMPILE_FLAGS "\"-I${CMAKE_SOURCE_DIR}/TarProp\"") diff --git a/Tests/IncludeDirectories/Flags/Flags.h b/Tests/IncludeDirectories/Flags/Flags.h new file mode 100644 index 0000000..0397515 --- /dev/null +++ b/Tests/IncludeDirectories/Flags/Flags.h @@ -0,0 +1 @@ +// include Flags.h diff --git a/Tests/IncludeDirectories/IncDir/IncDir.h b/Tests/IncludeDirectories/IncDir/IncDir.h new file mode 100644 index 0000000..7c0ca96 --- /dev/null +++ b/Tests/IncludeDirectories/IncDir/IncDir.h @@ -0,0 +1 @@ +// include IncDir.h diff --git a/Tests/IncludeDirectories/SrcProp/SrcProp.h b/Tests/IncludeDirectories/SrcProp/SrcProp.h new file mode 100644 index 0000000..18b42cc --- /dev/null +++ b/Tests/IncludeDirectories/SrcProp/SrcProp.h @@ -0,0 +1 @@ +// include SrcProp.h diff --git a/Tests/IncludeDirectories/TarProp/TarProp.h b/Tests/IncludeDirectories/TarProp/TarProp.h new file mode 100644 index 0000000..59326f6 --- /dev/null +++ b/Tests/IncludeDirectories/TarProp/TarProp.h @@ -0,0 +1 @@ +// include TarProp.h 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; +} -- cgit v0.12