diff options
Diffstat (limited to 'Tests/Properties/CMakeLists.txt')
-rw-r--r-- | Tests/Properties/CMakeLists.txt | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt index f93f553..74d99fa 100644 --- a/Tests/Properties/CMakeLists.txt +++ b/Tests/Properties/CMakeLists.txt @@ -146,18 +146,25 @@ check_cache_props() function(generate_file_for_set_property_test i target_name) set(src_path "${CMAKE_CURRENT_BINARY_DIR}/src${i}.cpp") - file(GENERATE OUTPUT "${src_path}" CONTENT + file(CONFIGURE OUTPUT "${src_path}" CONTENT "#ifndef def${i}\n\ #error Expected def${i}\n\ #endif\n\ #ifdef _WIN32\n\ __declspec(dllexport)\n\ #endif\n\ - void dummy_symbol${i}() {}\n") + void dummy_symbol${i}() {}\n" + NEWLINE_STYLE UNIX) target_sources(${target_name} PRIVATE "${src_path}") endfunction() add_library(maindirtest SHARED) + +# Generate file to be used with both DIRECTORY and TARGET_DIRECTORY options in +# set_source_files_properties and set_property(). +generate_file_for_set_property_test(32 maindirtest) +generate_file_for_set_property_test(33 maindirtest) + add_subdirectory(SubDir2) set(src_prefix "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/") @@ -233,6 +240,19 @@ set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src30.cpp" set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src30.cpp" "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src31.cpp") + +# Check that specifying both DIRECTORY and TARGET_DIRECTORY works. +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src32.cpp" + DIRECTORY . + TARGET_DIRECTORY set_prop_lib_3 + PROPERTIES COMPILE_DEFINITIONS "def32") + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/src33.cpp" + DIRECTORY SubDir2 + TARGET_DIRECTORY maindirtest + PROPERTY COMPILE_DEFINITIONS "def33") + + function(check_get_property_value expected) if(NOT actual STREQUAL expected) message(SEND_ERROR "Error: get_property returned unexpected value\n" |