diff options
Diffstat (limited to 'Tests/RunCMake/File_Generate')
-rw-r--r-- | Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/File_Generate/Target.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/File_Generate/sub1/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/RunCMake/File_Generate/sub2/CMakeLists.txt | 7 |
4 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 770fc6e..48fb71c 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -33,6 +33,13 @@ foreach(l CXX C) endif() endforeach() +run_cmake(Target) +file(READ "${RunCMake_BINARY_DIR}/Target-build/sub1/output.txt" sub_1) +file(READ "${RunCMake_BINARY_DIR}/Target-build/sub2/output.txt" sub_2) +if(NOT sub_1 MATCHES "first" OR NOT sub_2 MATCHES "second") + message(SEND_ERROR "Wrong target used by TARGET argument! ${sub_1} ${sub_2}") +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") diff --git a/Tests/RunCMake/File_Generate/Target.cmake b/Tests/RunCMake/File_Generate/Target.cmake new file mode 100644 index 0000000..16e8457 --- /dev/null +++ b/Tests/RunCMake/File_Generate/Target.cmake @@ -0,0 +1,2 @@ +add_subdirectory(sub1) +add_subdirectory(sub2) diff --git a/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt b/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt new file mode 100644 index 0000000..34c51a4 --- /dev/null +++ b/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(library IMPORTED STATIC) +set_property(TARGET library PROPERTY COMPILE_DEFINITIONS "first") + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output.txt" + CONTENT "$<TARGET_PROPERTY:COMPILE_DEFINITIONS>" + TARGET library +) diff --git a/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt b/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt new file mode 100644 index 0000000..09b81ac --- /dev/null +++ b/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(library IMPORTED STATIC) +set_property(TARGET library PROPERTY COMPILE_DEFINITIONS "second") + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output.txt" + CONTENT "$<TARGET_PROPERTY:COMPILE_DEFINITIONS>" + TARGET library +) |