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.
This commit is contained in:
Brad King 2011-06-07 14:04:00 -04:00 committed by CMake Topic Stage
commit 313a633b85
4 changed files with 74 additions and 1 deletions

View File

@ -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

View File

@ -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)

View File

@ -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()

View File

@ -0,0 +1,9 @@
#include "Flags.h"
#include "IncDir.h"
#include "SrcProp.h"
#include "TarProp.h"
int main(int argc, char** argv)
{
return 0;
}