Stephen Kelly eef6df5c7d Fix OLD behavior of CMP0021.
Exclude Ninja and Xcode from the CMP0021 test

They do not behave the same as the makefile generator with
relative paths.

Don't overwrite the header file for in-source builds.
2013-08-24 15:14:56 +02:00

15 lines
440 B
CMake

cmake_policy(SET CMP0021 OLD)
add_executable(cmp0021exe main.cpp)
if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/includes")
execute_process(COMMAND ${CMAKE_COMMAND} -E
copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/includes"
"${CMAKE_CURRENT_BINARY_DIR}/includes"
)
endif()
set_property(TARGET cmp0021exe PROPERTY
INCLUDE_DIRECTORIES includes/cmp0021)