2011-06-02 18:28:10 +04:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
|
|
|
project(IncludeDirectories)
|
|
|
|
|
2011-06-03 21:45:31 +04:00
|
|
|
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
|
|
|
|
")
|
|
|
|
|
2011-06-04 00:16:50 +04:00
|
|
|
# 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()
|
|
|
|
|
2011-06-03 21:45:31 +04:00
|
|
|
include_directories(${CMAKE_BINARY_DIR}/IncDir)
|
2011-06-04 00:16:50 +04:00
|
|
|
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()
|
|
|
|
|
2011-06-02 18:28:10 +04:00
|
|
|
add_executable(IncludeDirectories main.cpp)
|
2011-06-04 00:16:50 +04:00
|
|
|
|
|
|
|
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()
|
2011-11-05 19:17:49 +04:00
|
|
|
|
|
|
|
add_subdirectory(TargetIncludeDirectories)
|