diff options
Diffstat (limited to 'Tests/RunCMake')
384 files changed, 3250 insertions, 166 deletions
diff --git a/Tests/RunCMake/BuildDepends/FortranInclude.cmake b/Tests/RunCMake/BuildDepends/FortranInclude.cmake index fa9f399..ad5fd0a 100644 --- a/Tests/RunCMake/BuildDepends/FortranInclude.cmake +++ b/Tests/RunCMake/BuildDepends/FortranInclude.cmake @@ -1,5 +1,10 @@ enable_language(Fortran) +if("${CMAKE_Fortran_COMPILER_ID};${CMAKE_Fortran_SIMULATE_ID}" MATCHES "^Intel(LLVM)?;MSVC$") + string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -Z7") + string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO " -Z7") +endif() + set(check_pairs "") add_executable(preprocess FortranIncludePreprocess.F) diff --git a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake index c31e4ba..ab9e405 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake +++ b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake @@ -1,6 +1,3 @@ -# Prevent duplicate errors on some platforms. -set(CMAKE_IMPORT_LIBRARY_SUFFIX "placeholder") - add_library(unknown_lib UNKNOWN IMPORTED) add_library(static_lib STATIC IMPORTED) add_library(shared_lib SHARED IMPORTED) diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt index 91a90e5..c6439e2 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt @@ -1,17 +1,6 @@ -^CMake Error in CMakeLists.txt: - IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration +^(CMake Error in CMakeLists.txt: + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static)_lib"( configuration "[^"]+")?. -+ -CMake Error in CMakeLists.txt: - IMPORTED_LOCATION not set for imported target "static_lib"( configuration - "[^"]+")?. -+ -CMake Error in CMakeLists.txt: - IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration - "[^"]+")?.( -+ -CMake Error in CMakeLists.txt: - IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration - "[^"]+")?.)* -+ +)+ +.*(IMPORTED_LOCATION or )?IMPORTED_IMPLIB not set for imported target.*"shared_lib".* CMake Generate step failed. Build files cannot be regenerated correctly.$ diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt index 27af911..7a46c41 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt @@ -1,39 +1,19 @@ -^CMake Warning \(dev\) in CMakeLists.txt: +^(CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0111 is not set: An imported target missing its location property fails during generation. Run "cmake --help-policy CMP0111" for policy details. Use the cmake_policy command to set the policy and suppress this warning. - IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static)_lib"( configuration "[^"]+")?. This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) in CMakeLists.txt: ++)+CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0111 is not set: An imported target missing its location property fails during generation. Run "cmake --help-policy CMP0111" for policy details. Use the cmake_policy command to set the policy and suppress this warning. - IMPORTED_LOCATION not set for imported target "static_lib"( configuration + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static)_lib"( configuration "[^"]+")?. -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0111 is not set: An imported target missing its location property - fails during generation. Run "cmake --help-policy CMP0111" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - - IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration - "[^"]+")?. -This warning is for project developers. Use -Wno-dev to suppress it.( -+ -CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0111 is not set: An imported target missing its location property - fails during generation. Run "cmake --help-policy CMP0111" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - - IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration - "[^"]+")?. -This warning is for project developers. Use -Wno-dev to suppress it.)*$ +.*(IMPORTED_LOCATION or )?IMPORTED_IMPLIB not set for imported target.*"shared_lib".* +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt index 67d00f7..3472f33 100644 --- a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt @@ -1,4 +1,13 @@ -^CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0115 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. ++ +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): Cannot find source file: noexist diff --git a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt index 10e83a9..930dd3c 100644 --- a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt +++ b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt @@ -1,4 +1,15 @@ -^CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\): +^CMake Deprecation Warning at CMP0116-Mixed\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\): Policy CMP0116 is not set: Ninja generators transform DEPFILEs from add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy details\. Use the cmake_policy command to set the policy and suppress this diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt new file mode 100644 index 0000000..887601c --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt new file mode 100644 index 0000000..887601c --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt index 2af72a4..9285f9d 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt @@ -1,4 +1,15 @@ -^prop: `0` +^CMake Deprecation Warning at CMP0118-OLD-Test1\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +prop: `0` CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(target_sources\): Cannot find source file: diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt index 6109f65..9bd3d33 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test10\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt index e5e97de..4730caf 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test11\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt index e6c429c..69a07e1 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): +^CMake Deprecation Warning at CMP0118-OLD-Test12\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): TARGET 'custom[4-6]' was not created in this directory\. + CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt index 75dbf23..45c1dcb 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): +^CMake Deprecation Warning at CMP0118-OLD-Test13\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): TARGET 'custom[4-6]' was not created in this directory\. + CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt index f5b3d1a..7ade0cf 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test14\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt index a30bc84..5735539 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test15\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt index 403ce5a..74eb3e1 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt @@ -1 +1,12 @@ -^prop: `1`$ +^CMake Deprecation Warning at CMP0118-OLD-Test2\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +prop: `1`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt index 4f4fea3..cce5b19 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test3\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt index 3c80531..47eee2e 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test3b\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt index 9600fee..f17c9be 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test4\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` Generated_with_full_path1\.txt: # 1b # GENERATED = `0` Generated_with_full_path1\.txt: # 2a # GENERATED = `0` Generated_with_full_path1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt index e638660..388e90e 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test4b\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` Generated_with_full_path1\.txt: # 1b # GENERATED = `0` Generated_with_full_path1\.txt: # 2a # GENERATED = `0` Generated_with_full_path1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt index 18e6a8c..4a67fa7 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test5\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt index a60545f..0cad373 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test6\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `1` Generated_source1\.txt: # 1b # GENERATED = `1` Generated_source1\.txt: # 2a # GENERATED = `1` Generated_source1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt index fd496cb..7f232d5 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test7\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `1` Generated_source1\.txt: # 1b # GENERATED = `1` Generated_source1\.txt: # 2a # GENERATED = `1` Generated_source1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt index 3505242..dd9d2ef 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test8\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `0` Generated_source1\.txt: # 1b # GENERATED = `0` Generated_source1\.txt: # 2a # GENERATED = `0` Generated_source1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt index 63a9341..e01f782 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test9\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `0` Generated_source1\.txt: # 1b # GENERATED = `0` Generated_source1\.txt: # 2a # GENERATED = `0` Generated_source1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt index 5e9cf6c..2fc472b 100644 --- a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at GenInSubdir/CMakeLists\.txt:[0-9]+ \(target_sources\): +^CMake Deprecation Warning at GenInSubdir-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at GenInSubdir/CMakeLists\.txt:[0-9]+ \(target_sources\): Cannot find source file: [^ diff --git a/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt b/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt new file mode 100644 index 0000000..86eac41 --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0119-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0119 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0152/CMP0152-Common.cmake b/Tests/RunCMake/CMP0152/CMP0152-Common.cmake new file mode 100644 index 0000000..6429cca --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-Common.cmake @@ -0,0 +1,5 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin/") +file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin" "${CMAKE_CURRENT_BINARY_DIR}/dir/bin" SYMBOLIC) +file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/../" real_path) diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake b/Tests/RunCMake/CMP0152/CMP0152-NEW-stdout.txt index e69de29..e69de29 100644 --- a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake +++ b/Tests/RunCMake/CMP0152/CMP0152-NEW-stdout.txt diff --git a/Tests/RunCMake/CMP0152/CMP0152-NEW.cmake b/Tests/RunCMake/CMP0152/CMP0152-NEW.cmake new file mode 100644 index 0000000..86a3b55 --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0152 NEW) +include(CMP0152-Common.cmake) diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake b/Tests/RunCMake/CMP0152/CMP0152-OLD-stderr.txt index e69de29..e69de29 100644 --- a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake +++ b/Tests/RunCMake/CMP0152/CMP0152-OLD-stderr.txt diff --git a/Tests/RunCMake/CMP0152/CMP0152-OLD.cmake b/Tests/RunCMake/CMP0152/CMP0152-OLD.cmake new file mode 100644 index 0000000..62ac300 --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0152 OLD) +include(CMP0152-Common.cmake) diff --git a/Tests/RunCMake/CMP0152/CMP0152-WARN-stderr.txt b/Tests/RunCMake/CMP0152/CMP0152-WARN-stderr.txt new file mode 100644 index 0000000..8d63168 --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-WARN-stderr.txt @@ -0,0 +1,27 @@ +^CMake Warning \(dev\) at CMP0152-Common\.cmake:[0-9]+ \(file\): + Policy CMP0152 is not set: file\(REAL_PATH\) resolves symlinks before + collapsing \.\./ components\. Run "cmake --help-policy CMP0152" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + From input path: + + [^ +]*/Tests/RunCMake/CMP0152/CMP0152-WARN-build/dir/bin/\.\./ + + the policy OLD behavior produces path: + + [^ +]*/Tests/RunCMake/CMP0152/CMP0152-WARN-build/dir + + but the policy NEW behavior produces path: + + [^ +]*/Tests/RunCMake/CMP0152/CMP0152-WARN-build/dir/nested + + Since the policy is not set, CMake is using the OLD behavior for + compatibility. +Call Stack \(most recent call first\): + CMP0152-WARN\.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/CMP0152/CMP0152-WARN.cmake b/Tests/RunCMake/CMP0152/CMP0152-WARN.cmake new file mode 100644 index 0000000..e85589e --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0152-Common.cmake) diff --git a/Tests/RunCMake/CMP0152/CMakeLists.txt b/Tests/RunCMake/CMP0152/CMakeLists.txt new file mode 100644 index 0000000..5ff8d3e --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.23) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0152/RunCMakeTest.cmake b/Tests/RunCMake/CMP0152/RunCMakeTest.cmake new file mode 100644 index 0000000..7a9bab3 --- /dev/null +++ b/Tests/RunCMake/CMP0152/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +if(NOT CMAKE_GENERATOR_NO_COMPILER_ENV) + run_cmake(CMP0152-WARN) + run_cmake(CMP0152-OLD) + run_cmake(CMP0152-NEW) +endif() diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt new file mode 100644 index 0000000..e24eee7 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/Tests/RunCMake/CMP0153/CMP0153-NEW\.cmake:[0-9]+ \(exec_program\): + The exec_program command should not be called; see CMP0153\.$ diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake b/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake new file mode 100644 index 0000000..d252b46 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0153 NEW) +exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"") diff --git a/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt new file mode 100644 index 0000000..1aa5183 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt @@ -0,0 +1 @@ +exec_program\(\) called diff --git a/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake b/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake new file mode 100644 index 0000000..d3c47a7 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0153 OLD) +exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"") diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt b/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt new file mode 100644 index 0000000..8f22d4e --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt @@ -0,0 +1,6 @@ +^CMake Warning \(dev\) at [^ +]*/Tests/RunCMake/CMP0153/CMP0153-WARN\.cmake:[0-9]+ \(exec_program\): + Policy CMP0153 is not set: The exec_program command should not be called\. + Run "cmake --help-policy CMP0153" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt new file mode 100644 index 0000000..1aa5183 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt @@ -0,0 +1 @@ +exec_program\(\) called diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake b/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake new file mode 100644 index 0000000..ba81501 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake @@ -0,0 +1 @@ +exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"") diff --git a/Tests/RunCMake/CMP0153/CMakeLists.txt b/Tests/RunCMake/CMP0153/CMakeLists.txt new file mode 100644 index 0000000..922aad6 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.27) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0153/RunCMakeTest.cmake b/Tests/RunCMake/CMP0153/RunCMakeTest.cmake new file mode 100644 index 0000000..3d01dbf --- /dev/null +++ b/Tests/RunCMake/CMP0153/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +function(run_cmp0153 name) + run_cmake_command(${name} ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/${name}.cmake") +endfunction() + +run_cmp0153(CMP0153-WARN) +run_cmp0153(CMP0153-OLD) +run_cmp0153(CMP0153-NEW) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 63b7568..02efb25 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -165,14 +165,21 @@ if(GIT_EXECUTABLE) add_RunCMake_test(CMP0150) endif() +if(NOT WIN32 OR CYGWIN) + add_RunCMake_test(CMP0152) +endif() + +add_RunCMake_test(CMP0153) + # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode # generators ignore. The policy will have no effect on those generators. if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") add_RunCMake_test(CMP0065 -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) endif() +add_executable(detect_jobserver detect_jobserver.c) if(CMAKE_GENERATOR MATCHES "Make") - add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU}) + add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU} -DDETECT_JOBSERVER=$<TARGET_FILE:detect_jobserver>) endif() unset(ninja_test_with_qt_version) unset(ninja_qt_args) @@ -363,7 +370,8 @@ if(CMake_TEST_FindOpenSSL) endif() if(CMake_TEST_UseSWIG) add_RunCMake_test(FindSWIG) - add_RunCMake_test(UseSWIG -DCMake_TEST_FindPython=${CMake_TEST_FindPython}) + add_RunCMake_test(UseSWIG -DCMake_TEST_FindPython2=${CMake_TEST_FindPython2} + -DCMake_TEST_FindPython3=${CMake_TEST_FindPython3}) endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) @@ -458,6 +466,7 @@ add_RunCMake_test(build_command) add_executable(exit_code exit_code.c) set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code> + -DPRINT_STDIN_EXE=$<TARGET_FILE:print_stdin> -DPython_EXECUTABLE=${Python_EXECUTABLE} ) if(NOT CMake_TEST_EXTERNAL_CMAKE) @@ -465,6 +474,9 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(execute_process) add_RunCMake_test(export) +if(CMake_TEST_MSYSTEM_PREFIX) + list(APPEND cmake_host_system_information_ARGS -DCMake_TEST_MSYSTEM_PREFIX=${CMake_TEST_MSYSTEM_PREFIX}) +endif() add_RunCMake_test(cmake_host_system_information) add_RunCMake_test(cmake_language) add_RunCMake_test(cmake_minimum_required) @@ -528,6 +540,7 @@ add_RunCMake_test(option) add_RunCMake_test(PrintHelpers) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(project_injected) +add_RunCMake_test(property_init) add_RunCMake_test(DependencyProviders) add_RunCMake_test(return) add_RunCMake_test(separate_arguments) @@ -695,6 +708,23 @@ endif() if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) add_RunCMake_test(Framework) + if(NOT DEFINED CMake_TEST_XcFramework) + set(CMake_TEST_XcFramework ON) + endif() + if(CMake_TEST_XcFramework AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 11.0) + set(XcFramework_ARGS -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}) + add_RunCMake_test(XcFramework) + + # This test can take a very long time due to lots of combinations. + # Use a long default timeout and provide an option to customize it. + if(NOT DEFINED CMake_TEST_XcFramework_TIMEOUT) + set(CMake_TEST_XcFramework_TIMEOUT 3000) + endif() + set_tests_properties(RunCMake.XcFramework PROPERTIES + TIMEOUT "${CMake_TEST_XcFramework_TIMEOUT}" + RUN_SERIAL TRUE + ) + endif() endif() add_RunCMake_test(File_Archive) @@ -825,7 +855,7 @@ endif() if(CMake_TEST_RunCMake_ExternalProject_DOWNLOAD_SERVER_TIMEOUT) list(APPEND ExternalProject_ARGS -DDOWNLOAD_SERVER_TIMEOUT=${CMake_TEST_RunCMake_ExternalProject_DOWNLOAD_SERVER_TIMEOUT}) endif() -add_RunCMake_test(ExternalProject) +add_RunCMake_test(ExternalProject -DDETECT_JOBSERVER=$<TARGET_FILE:detect_jobserver>) add_RunCMake_test(FetchContent) add_RunCMake_test(FetchContent_find_package) set(CTestCommandLine_ARGS -DPython_EXECUTABLE=${Python_EXECUTABLE}) @@ -1038,6 +1068,7 @@ add_RunCMake_test(CMakePresetsWorkflow ) add_RunCMake_test(VerifyHeaderSets) +add_RunCMake_test(set_tests_properties) if(${CMAKE_GENERATOR} MATCHES "Make|Ninja") add_RunCMake_test(TransformDepfile) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index c90d543..223a61c 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -472,7 +472,7 @@ add_test(test1 \"${CMAKE_COMMAND}\" -E false) add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"hello world\") add_test(test3 \"${CMAKE_COMMAND}\" -E true) set_tests_properties(test3 PROPERTIES DISABLED \"ON\") -add_test(test4 \"${CMAKE_COMMAND}/doesnt_exist\") +add_test(test4 \"${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist\") add_test(test5 \"${CMAKE_COMMAND}\" -E echo \"please skip\") set_tests_properties(test5 PROPERTIES SKIP_REGULAR_EXPRESSION \"please skip\") ") diff --git a/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt b/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt index ce30dc8..c57c378 100644 --- a/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt @@ -1 +1,2 @@ -Unable to find executable: .*doesnt_exist +Unable to find executable:[^ +]*does_not_exist diff --git a/Tests/RunCMake/CTestResourceAllocation/CMakeLists.txt.in b/Tests/RunCMake/CTestResourceAllocation/CMakeLists.txt.in index 9984421..7c08dcc 100644 --- a/Tests/RunCMake/CTestResourceAllocation/CMakeLists.txt.in +++ b/Tests/RunCMake/CTestResourceAllocation/CMakeLists.txt.in @@ -4,6 +4,8 @@ if(CASE_NAME MATCHES "^(.*)-ctest-s") set(projname "${CMAKE_MATCH_1}") project(${projname} NONE) include(CTest) - include("@RunCMake_SOURCE_DIR@/ResourceCommon.cmake") + if(NOT CASE_NAME MATCHES "^dynamic-resource-") + include("@RunCMake_SOURCE_DIR@/resource-common.cmake") + endif() include("@RunCMake_SOURCE_DIR@/${projname}.cmake") endif() diff --git a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake index f5f0699..42e13fc 100644 --- a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake @@ -179,3 +179,19 @@ run_ctest_resource(ensure_parallel 2 0 0) set(ENV{CTEST_RESOURCE_GROUP_COUNT} 2) run_ctest_resource(process_count 1 0 0) unset(ENV{CTEST_RESOURCE_GROUP_COUNT}) + +function(run_ctest_resource_dynamic name) + run_ctest("${name}-ctest-s" ${ARGN}) +endfunction() + +run_ctest_resource_dynamic(dynamic-resource -VV) +run_ctest_resource_dynamic(dynamic-resource-notenough) +run_ctest_resource_dynamic(dynamic-resource-nofile) +run_ctest_resource_dynamic(dynamic-resource-multiple-generators) +run_ctest_resource_dynamic(dynamic-resource-no-setup-fixture) +run_ctest_resource_dynamic(dynamic-resource-multiple-setup-fixtures) +run_ctest_resource_dynamic(dynamic-resource-no-required-fixture) +run_ctest_resource_dynamic(dynamic-resource-conflicting-spec -DCTEST_RESOURCE_SPEC_SOURCE=CACHE) +run_ctest_resource_dynamic(dynamic-resource-circular) +run_ctest_resource_dynamic(dynamic-resource-circular-no-required-fixtures) +run_ctest_resource_dynamic(dynamic-resource-relative-path) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-stderr.txt new file mode 100644 index 0000000..397ca38 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-stderr.txt @@ -0,0 +1,3 @@ +^Error: a cycle exists in the test dependency graph for the test "GenerateSpecFile"\. +Please fix the cycle and run ctest again. +No tests were found!!!$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-stderr.txt new file mode 100644 index 0000000..06ea90f --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-stderr.txt @@ -0,0 +1,2 @@ +^All tests that have RESOURCE_GROUPS must include the resource spec generator fixture in their FIXTURES_REQUIRED +No tests were found!!!$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures.cmake new file mode 100644 index 0000000..9accdf3 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures.cmake @@ -0,0 +1,11 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular.cmake new file mode 100644 index 0000000..4917e30 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular.cmake @@ -0,0 +1,12 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-stderr.txt new file mode 100644 index 0000000..4e4c01c --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-stderr.txt @@ -0,0 +1,2 @@ +^GENERATED_RESOURCE_SPEC_FILE test property cannot be used in conjunction with ResourceSpecFile option +No tests were found!!!$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec.cmake new file mode 100644 index 0000000..668b049 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec.cmake @@ -0,0 +1,10 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-ctest-s-stdout.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-ctest-s-stdout.txt new file mode 100644 index 0000000..ec97787 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-ctest-s-stdout.txt @@ -0,0 +1,24 @@ +test 2 + Start 2: GenerateSpecFile + +2: Test command: "?[^ +]*[\\/]bin([\\/][^\\/ +]+)?[\\/]cmake(\.exe)?"? "-E" "copy" "[^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resspec\.json" "[^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-ctest-s-build" +2: Working Directory: [^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-ctest-s-build +2: Test timeout computed to be: 600 +1/2 Test #2: GenerateSpecFile ................. Passed +[0-9]+\.[0-9]+ sec +Using generated resource spec file [^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-ctest-s-build/dynamic-resspec\.json +test 1 + Start 1: RealTest + +1: Test command: "?[^ +]*[\\/]bin([\\/][^\\/ +]+)?[\\/]cmake(\.exe)?"? "-E" "true" +1: Working Directory: [^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-ctest-s-build +1: Test timeout computed to be: 600 +2/2 Test #1: RealTest ......................... Passed +[0-9]+\.[0-9]+ sec diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-stderr.txt new file mode 100644 index 0000000..273cb80 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-stderr.txt @@ -0,0 +1,2 @@ +^Only one test may define the GENERATED_RESOURCE_SPEC_FILE property +No tests were found!!!$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators.cmake new file mode 100644 index 0000000..7ee58d4 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators.cmake @@ -0,0 +1,11 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile1 COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile2 COMMAND "${CMAKE_COMMAND}" -E true) +set_tests_properties(GenerateSpecFile1 GenerateSpecFile2 PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-stderr.txt new file mode 100644 index 0000000..39ee275 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-stderr.txt @@ -0,0 +1,2 @@ +^Test that defines GENERATED_RESOURCE_SPEC_FILE must have exactly one FIXTURES_SETUP +No tests were found!!!$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures.cmake new file mode 100644 index 0000000..a9e72ea --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures.cmake @@ -0,0 +1,10 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec;InvalidResourceSpec" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-stderr.txt new file mode 100644 index 0000000..06ea90f --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-stderr.txt @@ -0,0 +1,2 @@ +^All tests that have RESOURCE_GROUPS must include the resource spec generator fixture in their FIXTURES_REQUIRED +No tests were found!!!$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture.cmake new file mode 100644 index 0000000..1983678 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture.cmake @@ -0,0 +1,9 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + ) +set_tests_properties(RealTest PROPERTIES + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-stderr.txt new file mode 100644 index 0000000..39ee275 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-stderr.txt @@ -0,0 +1,2 @@ +^Test that defines GENERATED_RESOURCE_SPEC_FILE must have exactly one FIXTURES_SETUP +No tests were found!!!$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture.cmake new file mode 100644 index 0000000..b6dec5e --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture.cmake @@ -0,0 +1,9 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-stderr.txt new file mode 100644 index 0000000..343f632 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-stderr.txt @@ -0,0 +1,7 @@ +^Could not read/parse resource spec file [^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-build/dynamic-resspec\.json:[ ] +File not found: [^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-build/dynamic-resspec\.json +CMake Error at [^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s/test\.cmake:[0-9]+ \(message\): + Tests did not pass$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-stdout.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-stdout.txt new file mode 100644 index 0000000..fcf8ace --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile-ctest-s-stdout.txt @@ -0,0 +1,5 @@ + Start 2: GenerateSpecFile +1/2 Test #2: GenerateSpecFile .................\*\*\*Failed Invalid resource spec file +[0-9]+\.[0-9]+ sec + Start 1: RealTest +Failed test dependencies: GenerateSpecFile +2/2 Test #1: RealTest .........................\*\*\*Not Run +[0-9]+\.[0-9]+ sec diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile.cmake new file mode 100644 index 0000000..e771c60 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-nofile.cmake @@ -0,0 +1,10 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E true) +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-stderr.txt new file mode 100644 index 0000000..393ab84 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-stderr.txt @@ -0,0 +1,14 @@ +^Insufficient resources for test RealTest: + + Test requested resources of type 'widgets' in the following amounts: + 2 slots + but only the following units were available: + '0': 1 slot + +Resource spec file: + + [^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-build/dynamic-resspec\.json +CMake Error at [^ +]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s/test\.cmake:[0-9]+ \(message\): + Tests did not pass$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-stdout.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-stdout.txt new file mode 100644 index 0000000..b411a74 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough-ctest-s-stdout.txt @@ -0,0 +1,4 @@ + Start 2: GenerateSpecFile +1/2 Test #2: GenerateSpecFile ................. Passed +[0-9]+\.[0-9]+ sec + Start 1: RealTest +2/2 Test #1: RealTest .........................\*\*\*Not Run +[0-9]+\.[0-9]+ sec diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough.cmake new file mode 100644 index 0000000..c8e1313 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-notenough.cmake @@ -0,0 +1,10 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:2" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-result.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-stderr.txt new file mode 100644 index 0000000..2c4dff8 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-stderr.txt @@ -0,0 +1,2 @@ +^GENERATED_RESOURCE_SPEC_FILE must be an absolute path +No tests were found!!!$ diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path.cmake new file mode 100644 index 0000000..3ee83d7 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path.cmake @@ -0,0 +1,10 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource.cmake b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource.cmake new file mode 100644 index 0000000..668b049 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource.cmake @@ -0,0 +1,10 @@ +add_test(NAME RealTest COMMAND "${CMAKE_COMMAND}" -E true) +add_test(NAME GenerateSpecFile COMMAND "${CMAKE_COMMAND}" -E copy "${CTEST_DYNAMIC_RESOURCE_SPEC_FILE}" "${CMAKE_BINARY_DIR}") +set_tests_properties(GenerateSpecFile PROPERTIES + GENERATED_RESOURCE_SPEC_FILE "${CMAKE_BINARY_DIR}/dynamic-resspec.json" + FIXTURES_SETUP "ResourceSpec" + ) +set_tests_properties(RealTest PROPERTIES + FIXTURES_REQUIRED "ResourceSpec" + RESOURCE_GROUPS "widgets:1" + ) diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resspec.json b/Tests/RunCMake/CTestResourceAllocation/dynamic-resspec.json new file mode 100644 index 0000000..f9bedaf --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resspec.json @@ -0,0 +1,16 @@ +{ + "version": { + "major": 1, + "minor": 0 + }, + "local": [ + { + "widgets": [ + { + "id": "0", + "slots": 1 + } + ] + } + ] +} diff --git a/Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake b/Tests/RunCMake/CTestResourceAllocation/resource-common.cmake index ef79dce..ef79dce 100644 --- a/Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake +++ b/Tests/RunCMake/CTestResourceAllocation/resource-common.cmake diff --git a/Tests/RunCMake/CTestResourceAllocation/test.cmake.in b/Tests/RunCMake/CTestResourceAllocation/test.cmake.in index 9ad9ac8..319ebf1 100644 --- a/Tests/RunCMake/CTestResourceAllocation/test.cmake.in +++ b/Tests/RunCMake/CTestResourceAllocation/test.cmake.in @@ -8,9 +8,15 @@ set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") -set(config_options - "-DCTEST_RESOURCE_ALLOC_ENABLED=${CTEST_RESOURCE_ALLOC_ENABLED};-DCTRESALLOC_COMMAND=${CTRESALLOC_COMMAND}" - ) +if("@CASE_NAME@" MATCHES "^dynamic-resource-") + set(config_options + "-DCTEST_DYNAMIC_RESOURCE_SPEC_FILE=@RunCMake_SOURCE_DIR@/dynamic-resspec.json" + ) +else() + set(config_options + "-DCTEST_RESOURCE_ALLOC_ENABLED=${CTEST_RESOURCE_ALLOC_ENABLED};-DCTRESALLOC_COMMAND=${CTRESALLOC_COMMAND}" + ) +endif() if(CTEST_RESOURCE_SPEC_SOURCE STREQUAL "CMDLINE") list(APPEND config_options "-DCTEST_RESOURCE_SPEC_FILE=@RunCMake_SOURCE_DIR@/noexist.json") diff --git a/Tests/RunCMake/CXXModules/CMakeLists.txt b/Tests/RunCMake/CXXModules/CMakeLists.txt index 88eb282..e23023d 100644 --- a/Tests/RunCMake/CXXModules/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.23) project(${RunCMake_TEST} NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CXXModules/NoCXX-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX-stderr.txt index aa7f406..102d497 100644 --- a/Tests/RunCMake/CXXModules/NoCXX-stderr.txt +++ b/Tests/RunCMake/CXXModules/NoCXX-stderr.txt @@ -6,15 +6,15 @@ Call Stack \(most recent call first\): This warning is for project developers. Use -Wno-dev to suppress it. CMake Error in CMakeLists.txt: - The "nocxx" target has C\+\+ module sources but the "CXX" language has not - been enabled + The target named "nocxx" has C\+\+ sources that export modules but the "CXX" + language has not been enabled ( CMake Error in CMakeLists.txt: -( The "nocxx" target has C\+\+ module sources but the "CXX" language has not - been enabled -| The "nocxx" target contains C\+\+ module sources which are not supported by - the generator +( The target named "nocxx" has C\+\+ sources that export modules but the "CXX" + language has not been enabled +| The target named "nocxx" contains C\+\+ sources that export modules which is + not supported by the generator ) )* CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt index 95d73b1..dd25689 100644 --- a/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt +++ b/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt @@ -6,15 +6,17 @@ Call Stack \(most recent call first\): This warning is for project developers. Use -Wno-dev to suppress it. CMake Error in CMakeLists.txt: - The "nocxx20" target has C\+\+ module sources but is not using at least - "cxx_std_20" + The target named "nocxx20" has C\+\+ sources that export modules but does not + include "cxx_std_20" \(or newer\) among its `target_compile_features`; found + "cxx_std_17" ( CMake Error in CMakeLists.txt: -( The "nocxx20" target has C\+\+ module sources but is not using at least - "cxx_std_20" -| The "nocxx20" target contains C\+\+ module sources which are not supported by - the generator +( The target named "nocxx20" has C\+\+ sources that export modules but does not + include "cxx_std_20" \(or newer\) among its `target_compile_features`; found + "cxx_std_17" +| The target named "nocxx20" contains C\+\+ sources that export modules which + is not supported by the generator ) )* CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt index aa99af0..c2dc0b6 100644 --- a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt +++ b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt @@ -6,15 +6,15 @@ Call Stack \(most recent call first\): This warning is for project developers. Use -Wno-dev to suppress it. CMake Error in CMakeLists.txt: - The "noexperimentalflag" target has C\+\+ module sources but its experimental - support has not been requested + The target named "noexperimentalflag" has C\+\+ sources that export modules + but its experimental support has not been requested ( CMake Error in CMakeLists.txt: -( The "noexperimentalflag" target has C\+\+ module sources but its experimental - support has not been requested -| The "noexperimentalflag" target contains C\+\+ module sources which are not - supported by the generator +( The target named "noexperimentalflag" has C\+\+ sources that export modules + but its experimental support has not been requested +| The target named "noexperimentalflag" contains C\+\+ sources that export + modules which is not supported by the generator ) )* CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt b/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt index b63d291..c82a35a 100644 --- a/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt +++ b/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt @@ -13,13 +13,13 @@ This warning is for project developers. Use -Wno-dev to suppress it. due to lack of required features. Ninja 1.11 or higher is required. |CMake Error in CMakeLists.txt: - The "nodyndep" target contains C\+\+ module sources which are not supported - by the generator + The target named "nodyndep" contains C\+\+ sources that export modules which + is not supported by the generator ( CMake Error in CMakeLists.txt: - The "nodyndep" target contains C\+\+ module sources which are not supported - by the generator + The target named "nodyndep" contains C\+\+ sources that export modules which + is not supported by the generator )*) CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index d324ec9..0ca9945 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -148,6 +148,8 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(duplicate) set(RunCMake_CXXModules_NO_TEST 1) run_cxx_module_test(circular) + run_cxx_module_test(try-compile) + run_cxx_module_test(try-run) unset(RunCMake_CXXModules_NO_TEST) run_cxx_module_test(same-src-name) run_cxx_module_test(scan_properties) @@ -185,7 +187,20 @@ endif () if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(export-interface-no-properties-build) run_cxx_module_test(export-interface-build) + run_cxx_module_test(export-usage-build) run_cxx_module_test(export-bmi-and-interface-build) + + if ("collation" IN_LIST CMake_TEST_MODULE_COMPILATION AND + "bmionly" IN_LIST CMake_TEST_MODULE_COMPILATION) + set(test_suffix export-interface-build) + run_cxx_module_test(import-modules "import-modules-${test_suffix}" "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/${test_suffix}-build") + + set(test_suffix export-interface-no-properties-build) + run_cxx_module_test(import-modules "import-modules-${test_suffix}" "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/${test_suffix}-build" -DNO_PROPERTIES=1) + + set(test_suffix export-bmi-and-interface-build) + run_cxx_module_test(import-modules "import-modules-${test_suffix}" "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/${test_suffix}-build" -DWITH_BMIS=1) + endif () endif () # All of the following tests perform installation. @@ -199,6 +214,21 @@ if ("install_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(export-interface-no-properties-install) run_cxx_module_test(export-interface-install) + run_cxx_module_test(export-usage-install) run_cxx_module_test(export-bmi-and-interface-install) + + if ("collation" IN_LIST CMake_TEST_MODULE_COMPILATION AND + "bmionly" IN_LIST CMake_TEST_MODULE_COMPILATION) + set(RunCMake_CXXModules_INSTALL 0) + set(test_suffix export-interface-install) + run_cxx_module_test(import-modules "import-modules-${test_suffix}" "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/${test_suffix}-install") + + set(test_suffix export-interface-no-properties-install) + run_cxx_module_test(import-modules "import-modules-${test_suffix}" "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/${test_suffix}-install" -DNO_PROPERTIES=1) + + set(test_suffix export-bmi-and-interface-install) + run_cxx_module_test(import-modules "import-modules-${test_suffix}" "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/${test_suffix}-install" -DWITH_BMIS=1) + set(RunCMake_CXXModules_INSTALL 1) + endif () endif () endif () diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake index ff7219a..5f32364 100644 --- a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake @@ -1,4 +1,4 @@ -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") if (NOT EXISTS "${CMake_TEST_MODULE_COMPILATION_RULES}") message(FATAL_ERROR diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt index 78bdf2b..659414d 100644 --- a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt +++ b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): +CMake Warning \(dev\) at CMakeLists.txt:15 \(target_sources\): CMake's C\+\+ module support is experimental. It is meant only for experimentation and feedback to CMake developers. This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt index 515b240..78a1d0b 100644 --- a/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt @@ -3,6 +3,14 @@ project(cxx_modules_deep_chain CXX) include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + include(CheckCompilerFlag) + check_compiler_flag(CXX "-Wread-modules-implicitly" have_implicit_module_warning) + if (have_implicit_module_warning) + add_compile_options(-Werror=read-modules-implicitly) + endif () +endif () + add_library(a STATIC) target_sources(a PUBLIC diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt index d227e55..c17577c 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") find_package(export_bmi_and_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt index d46d28b..d608d67 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") find_package(export_bmi_and_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt index 3cd156a..106bd1e 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") find_package(export_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt index 71bf86c..c19283b 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") find_package(export_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt index 0c094ac..fba05f4 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") find_package(export_interfaces_no_properties REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt index 0c094ac..fba05f4 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") find_package(export_interfaces_no_properties REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-usage-build-stderr.txt new file mode 100644 index 0000000..78bdf2b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-build-stderr.txt @@ -0,0 +1,4 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-usage-build/CMakeLists.txt new file mode 100644 index 0000000..86a608b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-build/CMakeLists.txt @@ -0,0 +1,110 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_usage CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_usage STATIC) +target_sources(export_usage + PRIVATE + forward.cxx + PRIVATE + FILE_SET modules_private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + private.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export_usage PUBLIC cxx_std_20) + +list(APPEND CMAKE_CXX_KNOWN_FEATURES + exported + buildiface + installiface + buildlocaliface) + +target_include_directories(export_usage + PRIVATE + "/usr/exported" + "$<BUILD_INTERFACE:/usr/buildiface>" + "$<INSTALL_INTERFACE:/usr/installiface>" + "$<BUILD_LOCAL_INTERFACE:/usr/buildlocaliface>") +target_compile_definitions(export_usage + PRIVATE + "exported" + "$<BUILD_INTERFACE:buildiface>" + "$<INSTALL_INTERFACE:installiface>" + "$<BUILD_LOCAL_INTERFACE:buildlocaliface>") +target_compile_features(export_usage + PRIVATE + "cxx_std_11" + "$<BUILD_INTERFACE:cxx_std_14>" + "$<INSTALL_INTERFACE:cxx_std_17>" + "$<BUILD_LOCAL_INTERFACE:cxx_std_20>") + +if (MSVC) + set(variable_flag "-constexpr:depth") +else () + set(variable_flag "-fconstexpr-depth=") +endif () + +target_compile_options(export_usage + PRIVATE + "${variable_flag}100" + "$<BUILD_INTERFACE:${variable_flag}200>" + "$<INSTALL_INTERFACE:${variable_flag}300>" + "$<BUILD_LOCAL_INTERFACE:${variable_flag}400>") + +add_library(export_used INTERFACE) +add_library(export_build INTERFACE) +add_library(export_install INTERFACE) +add_library(export_never INTERFACE) + +target_link_libraries(export_usage + PRIVATE + "export_used" + "$<BUILD_INTERFACE:export_build>" + "$<INSTALL_INTERFACE:export_install>" + "$<BUILD_LOCAL_INTERFACE:export_never>") + +install(TARGETS export_usage + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu") +export(EXPORT CXXModules + NAMESPACE CXXModules:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/export_usage-targets.cmake") +install(TARGETS export_used export_build export_install + EXPORT CXXModulesDeps) +export(EXPORT CXXModulesDeps + NAMESPACE CXXModules:: + FILE "${CMAKE_CURRENT_BINARY_DIR}/export_usage-dep-targets.cmake") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_usage-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_usage-dep-targets.cmake\") +include(\"\${CMAKE_CURRENT_LIST_DIR}/export_usage-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") + +set(generator + -G "${CMAKE_GENERATOR}") +if (CMAKE_GENERATOR_TOOLSET) + list(APPEND generator + -T "${CMAKE_GENERATOR_TOOLSET}") +endif () +if (CMAKE_GENERATOR_PLATFORM) + list(APPEND generator + -A "${CMAKE_GENERATOR_PLATFORM}") +endif () + +add_test(NAME export_usage_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_dir=${CMAKE_CURRENT_SOURCE_DIR}" + "-Dexport_interfaces_flag=${variable_flag}" + "-Dexport_usage_DIR=${CMAKE_CURRENT_BINARY_DIR}" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-build/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-usage-build/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-build/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-usage-build/importable.cxx new file mode 100644 index 0000000..8dfc41b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-build/importable.cxx @@ -0,0 +1,10 @@ +export module importable; + +extern "C++" { +int forwarding(); +} + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-build/private.cxx b/Tests/RunCMake/CXXModules/examples/export-usage-build/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-build/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-usage-build/test/CMakeLists.txt new file mode 100644 index 0000000..adec9e7 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-build/test/CMakeLists.txt @@ -0,0 +1,69 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_library NONE) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") + +find_package(export_usage REQUIRED) + +if (NOT TARGET CXXModules::export_usage) + message(FATAL_ERROR + "Missing imported target") +endif () + +if (NOT TARGET CXXModules::export_used) + message(FATAL_ERROR + "Missing imported target") +endif () + +if (NOT TARGET CXXModules::export_build) + message(FATAL_ERROR + "Missing imported target") +endif () + +if (NOT TARGET CXXModules::export_install) + message(FATAL_ERROR + "Missing imported target") +endif () + +if (TARGET CXXModules::export_never) + message(FATAL_ERROR + "Extra imported target") +endif () + +function (check_property expected property) + get_property(actual TARGET CXXModules::export_usage + PROPERTY "${property}") + if (NOT actual STREQUAL expected) + message(SEND_ERROR + "Mismatch for ${property}:\n expected: ${expected}\n actual: ${actual}") + endif () +endfunction () + +check_property("/usr/exported;/usr/buildiface" "IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES") +check_property("exported;buildiface" "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS") +check_property("cxx_std_20;cxx_std_11;cxx_std_14" "IMPORTED_CXX_MODULES_COMPILE_FEATURES") +check_property("${export_interfaces_flag}100;${export_interfaces_flag}200" "IMPORTED_CXX_MODULES_COMPILE_OPTIONS") +check_property("$<COMPILE_ONLY:CXXModules::export_used>;$<COMPILE_ONLY:CXXModules::export_build>" "IMPORTED_CXX_MODULES_LINK_LIBRARIES") + +# Extract the export-dependent targets from the export file. +file(STRINGS "${export_usage_DIR}/export_usage-targets.cmake" usage_dependent_targets + REGEX "foreach._target ") +# Rudimentary argument splitting. +string(REPLACE " " ";" usage_dependent_targets "${usage_dependent_targets}") +# Keep only "target" names. +list(FILTER usage_dependent_targets INCLUDE REGEX "CXXModules::") +# Strip quotes. +string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}") + +if (NOT "CXXModules::export_used" IN_LIST usage_dependent_targets) + message(SEND_ERROR + "The main export does not require the 'CXXModules::export_used' target") +endif () +if (NOT "CXXModules::export_build" IN_LIST usage_dependent_targets) + message(SEND_ERROR + "The main export does not require the 'CXXModules::export_build' target") +endif () +if ("CXXModules::export_install" IN_LIST usage_dependent_targets) + message(SEND_ERROR + "The main export requires the 'CXXModules::export_install' target") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-usage-install-stderr.txt new file mode 100644 index 0000000..78bdf2b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-install-stderr.txt @@ -0,0 +1,4 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-usage-install/CMakeLists.txt new file mode 100644 index 0000000..11f53b0 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-install/CMakeLists.txt @@ -0,0 +1,114 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_export_usage CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(export_usage STATIC) +target_sources(export_usage + PRIVATE + forward.cxx + PRIVATE + FILE_SET modules_private TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + private.cxx + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}" + FILES + importable.cxx) +target_compile_features(export_usage PUBLIC cxx_std_20) + +list(APPEND CMAKE_CXX_KNOWN_FEATURES + exported + buildiface + installiface + buildlocaliface) + +target_include_directories(export_usage + PRIVATE + "/usr/exported" + "$<BUILD_INTERFACE:/usr/buildiface>" + "$<INSTALL_INTERFACE:/usr/installiface>" + "$<BUILD_LOCAL_INTERFACE:/usr/buildlocaliface>") +target_compile_definitions(export_usage + PRIVATE + "exported" + "$<BUILD_INTERFACE:buildiface>" + "$<INSTALL_INTERFACE:installiface>" + "$<BUILD_LOCAL_INTERFACE:buildlocaliface>") +target_compile_features(export_usage + PRIVATE + "cxx_std_11" + "$<BUILD_INTERFACE:cxx_std_14>" + "$<INSTALL_INTERFACE:cxx_std_17>" + "$<BUILD_LOCAL_INTERFACE:cxx_std_20>") + +if (MSVC) + set(variable_flag "-constexpr:depth") +else () + set(variable_flag "-fconstexpr-depth=") +endif () + +target_compile_options(export_usage + PRIVATE + "${variable_flag}100" + "$<BUILD_INTERFACE:${variable_flag}200>" + "$<INSTALL_INTERFACE:${variable_flag}300>" + "$<BUILD_LOCAL_INTERFACE:${variable_flag}400>") + +add_library(export_used INTERFACE) +add_library(export_build INTERFACE) +add_library(export_install INTERFACE) +add_library(export_never INTERFACE) + +target_link_libraries(export_usage + PRIVATE + "export_used" + "$<BUILD_INTERFACE:export_build>" + "$<INSTALL_INTERFACE:export_install>" + "$<BUILD_LOCAL_INTERFACE:export_never>") + +install(TARGETS export_usage + EXPORT CXXModules + FILE_SET modules DESTINATION "lib/cxx/miu") +install(EXPORT CXXModules + NAMESPACE CXXModules:: + DESTINATION "lib/cmake/export_usage" + FILE "export_usage-targets.cmake") +install(TARGETS export_used export_build export_install + EXPORT CXXModulesDeps) +install(EXPORT CXXModulesDeps + NAMESPACE CXXModules:: + DESTINATION "lib/cmake/export_usage" + FILE "export_usage-dep-targets.cmake") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_usage-config.cmake" + "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_usage-dep-targets.cmake\") +include(\"\${CMAKE_CURRENT_LIST_DIR}/export_usage-targets.cmake\") +set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1) +") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_usage-config.cmake" + DESTINATION "lib/cmake/export_usage") + +set(generator + -G "${CMAKE_GENERATOR}") +if (CMAKE_GENERATOR_TOOLSET) + list(APPEND generator + -T "${CMAKE_GENERATOR_TOOLSET}") +endif () +if (CMAKE_GENERATOR_PLATFORM) + list(APPEND generator + -A "${CMAKE_GENERATOR_PLATFORM}") +endif () + +add_test(NAME export_usage_build + COMMAND + "${CMAKE_COMMAND}" + "-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu" + "-Dexport_interfaces_flag=${variable_flag}" + "-Dexport_usage_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_usage" + ${generator} + -S "${CMAKE_CURRENT_SOURCE_DIR}/test" + -B "${CMAKE_CURRENT_BINARY_DIR}/test") diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-install/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-usage-install/forward.cxx new file mode 100644 index 0000000..7f53271 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-install/forward.cxx @@ -0,0 +1,6 @@ +import priv; + +int forwarding() +{ + return from_private(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-usage-install/importable.cxx new file mode 100644 index 0000000..8dfc41b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-install/importable.cxx @@ -0,0 +1,10 @@ +export module importable; + +extern "C++" { +int forwarding(); +} + +export int from_import() +{ + return forwarding(); +} diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-install/private.cxx b/Tests/RunCMake/CXXModules/examples/export-usage-install/private.cxx new file mode 100644 index 0000000..c5b719a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-install/private.cxx @@ -0,0 +1,6 @@ +export module priv; + +export int from_private() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/export-usage-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-usage-install/test/CMakeLists.txt new file mode 100644 index 0000000..9ccd63a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-usage-install/test/CMakeLists.txt @@ -0,0 +1,69 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_library NONE) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") + +find_package(export_usage REQUIRED) + +if (NOT TARGET CXXModules::export_usage) + message(FATAL_ERROR + "Missing imported target") +endif () + +if (NOT TARGET CXXModules::export_used) + message(FATAL_ERROR + "Missing imported target") +endif () + +if (NOT TARGET CXXModules::export_build) + message(FATAL_ERROR + "Missing imported target") +endif () + +if (NOT TARGET CXXModules::export_install) + message(FATAL_ERROR + "Missing imported target") +endif () + +if (TARGET CXXModules::export_never) + message(FATAL_ERROR + "Extra imported target") +endif () + +function (check_property expected property) + get_property(actual TARGET CXXModules::export_usage + PROPERTY "${property}") + if (NOT actual STREQUAL expected) + message(SEND_ERROR + "Mismatch for ${property}:\n expected: ${expected}\n actual : ${actual}") + endif () +endfunction () + +check_property("/usr/exported;/usr/installiface" "IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES") +check_property("exported;installiface" "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS") +check_property("cxx_std_20;cxx_std_11;cxx_std_17" "IMPORTED_CXX_MODULES_COMPILE_FEATURES") +check_property("${export_interfaces_flag}100;${export_interfaces_flag}300" "IMPORTED_CXX_MODULES_COMPILE_OPTIONS") +check_property("$<COMPILE_ONLY:CXXModules::export_used>;$<COMPILE_ONLY:CXXModules::export_install>" "IMPORTED_CXX_MODULES_LINK_LIBRARIES") + +# Extract the export-dependent targets from the export file. +file(STRINGS "${export_usage_DIR}/export_usage-targets.cmake" usage_dependent_targets + REGEX "foreach._target ") +# Rudimentary argument splitting. +string(REPLACE " " ";" usage_dependent_targets "${usage_dependent_targets}") +# Keep only "target" names. +list(FILTER usage_dependent_targets INCLUDE REGEX "CXXModules::") +# Strip quotes. +string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}") + +if (NOT "CXXModules::export_used" IN_LIST usage_dependent_targets) + message(SEND_ERROR + "The main export does not require the 'CXXModules::export_used' target") +endif () +if ("CXXModules::export_build" IN_LIST usage_dependent_targets) + message(SEND_ERROR + "The main export requires the 'CXXModules::export_build' target") +endif () +if (NOT "CXXModules::export_install" IN_LIST usage_dependent_targets) + message(SEND_ERROR + "The main export does not require the 'CXXModules::export_install' target") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/generated-stderr.txt b/Tests/RunCMake/CXXModules/examples/generated-stderr.txt index 1dd9876..06160ce 100644 --- a/Tests/RunCMake/CXXModules/examples/generated-stderr.txt +++ b/Tests/RunCMake/CXXModules/examples/generated-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(dev\) at CMakeLists.txt:12 \(target_sources\): +CMake Warning \(dev\) at CMakeLists.txt:16 \(target_sources\): CMake's C\+\+ module support is experimental. It is meant only for experimentation and feedback to CMake developers. This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/generated/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/generated/CMakeLists.txt index 73f7ff7..9a8da3d 100644 --- a/Tests/RunCMake/CXXModules/examples/generated/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/generated/CMakeLists.txt @@ -3,10 +3,14 @@ project(cxx_modules_generated CXX) include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/importable.cxx.in" - "${CMAKE_CURRENT_BINARY_DIR}/importable.cxx" - COPYONLY) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/importable.cxx" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/importable.cxx.in" + COMMAND "${CMAKE_COMMAND}" + -E copy_if_different + "${CMAKE_CURRENT_SOURCE_DIR}/importable.cxx.in" + "${CMAKE_CURRENT_BINARY_DIR}/importable.cxx" + COMMENT "Copying 'importable.cxx'") add_executable(generated) target_sources(generated diff --git a/Tests/RunCMake/CXXModules/examples/import-modules-export-bmi-and-interface-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-modules-export-bmi-and-interface-build-stderr.txt new file mode 100644 index 0000000..71ee795 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/import-modules-export-bmi-and-interface-build-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at .*/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-build/export_bmi_and_interfaces-targets.cmake:[0-9]* \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + .*/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-build/export_bmi_and_interfaces-config.cmake:1 \(include\) + CMakeLists.txt:15 \(find_package\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/import-modules-export-bmi-and-interface-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-modules-export-bmi-and-interface-install-stderr.txt new file mode 100644 index 0000000..d22b2a1 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/import-modules-export-bmi-and-interface-install-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at .*/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-install/lib/cmake/export_bmi_and_interfaces/export_bmi_and_interfaces-targets.cmake:[0-9]* \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + .*/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-install/lib/cmake/export_bmi_and_interfaces/export_bmi_and_interfaces-config.cmake:1 \(include\) + CMakeLists.txt:15 \(find_package\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-build-stderr.txt new file mode 100644 index 0000000..f79abbc --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-build-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at .*/Tests/RunCMake/CXXModules/examples/export-interface-build-build/export_interfaces-targets.cmake:[0-9]* \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + .*/Tests/RunCMake/CXXModules/examples/export-interface-build-build/export_interfaces-config.cmake:1 \(include\) + CMakeLists.txt:15 \(find_package\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-install-stderr.txt new file mode 100644 index 0000000..32f9452 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-install-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at .*/Tests/RunCMake/CXXModules/examples/export-interface-install-install/lib/cmake/export_interfaces/export_interfaces-targets.cmake:[0-9]* \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + .*/Tests/RunCMake/CXXModules/examples/export-interface-install-install/lib/cmake/export_interfaces/export_interfaces-config.cmake:1 \(include\) + CMakeLists.txt:15 \(find_package\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-no-properties-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-no-properties-build-stderr.txt new file mode 100644 index 0000000..9254936 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-no-properties-build-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at .*/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build-build/export_interfaces_no_properties-targets.cmake:[0-9]* \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + .*/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build-build/export_interfaces_no_properties-config.cmake:1 \(include\) + CMakeLists.txt:15 \(find_package\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-no-properties-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-no-properties-install-stderr.txt new file mode 100644 index 0000000..71269f4 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/import-modules-export-interface-no-properties-install-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at .*/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install-install/lib/cmake/export_interfaces_no_properties/export_interfaces_no_properties-targets.cmake:[0-9]* \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +Call Stack \(most recent call first\): + .*/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install-install/lib/cmake/export_interfaces_no_properties/export_interfaces_no_properties-config.cmake:1 \(include\) + CMakeLists.txt:15 \(find_package\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/import-modules/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-modules/CMakeLists.txt new file mode 100644 index 0000000..3e6f379 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/import-modules/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_import_interfaces CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +if (NO_PROPERTIES) + set(package_name "export_interfaces_no_properties") +elseif (WITH_BMIS) + set(package_name "export_bmi_and_interfaces") +else () + set(package_name "export_interfaces") +endif () +set(target_name "CXXModules::${package_name}") + +find_package("${package_name}" REQUIRED) + +add_executable(use_import_interfaces) +target_sources(use_import_interfaces + PRIVATE + use.cxx) +target_compile_features(use_import_interfaces PRIVATE cxx_std_20) +target_link_libraries(use_import_interfaces PRIVATE "${target_name}") + +add_test(NAME use_import_interfaces COMMAND use_import_interfaces) diff --git a/Tests/RunCMake/CXXModules/examples/import-modules/use.cxx b/Tests/RunCMake/CXXModules/examples/import-modules/use.cxx new file mode 100644 index 0000000..feb38d2 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/import-modules/use.cxx @@ -0,0 +1,6 @@ +import importable; + +int main(int argc, char* argv[]) +{ + return from_import(); +} diff --git a/Tests/RunCMake/CXXModules/examples/try-compile-stderr.txt b/Tests/RunCMake/CXXModules/examples/try-compile-stderr.txt new file mode 100644 index 0000000..571bb9c --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-compile-stderr.txt @@ -0,0 +1,4 @@ +CMake Warning \(dev\) at CMakeLists.txt:[0-9]* \(try_compile\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/try-compile/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/try-compile/CMakeLists.txt new file mode 100644 index 0000000..dee61f1 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-compile/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_try_compile CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") +try_compile(can_use_modules + SOURCES_TYPE CXX_MODULE + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/importable.cxx" + SOURCES_TYPE NORMAL + SOURCE_FROM_FILE + use_importable.cxx "${CMAKE_CURRENT_LIST_DIR}/use_importable.cxx" + CXX_STANDARD 20) + +if (NOT can_use_modules) + message(FATAL_ERROR + "`try_compile` could not compile sources using modules.") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/try-compile/importable.cxx b/Tests/RunCMake/CXXModules/examples/try-compile/importable.cxx new file mode 100644 index 0000000..607680a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-compile/importable.cxx @@ -0,0 +1,6 @@ +export module importable; + +export int from_import() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/try-compile/use_importable.cxx b/Tests/RunCMake/CXXModules/examples/try-compile/use_importable.cxx new file mode 100644 index 0000000..8d6bab2 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-compile/use_importable.cxx @@ -0,0 +1,6 @@ +import importable; + +int foo() +{ + return from_import(); +} diff --git a/Tests/RunCMake/CXXModules/examples/try-run-stderr.txt b/Tests/RunCMake/CXXModules/examples/try-run-stderr.txt new file mode 100644 index 0000000..508db55 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-run-stderr.txt @@ -0,0 +1,4 @@ +CMake Warning \(dev\) at CMakeLists.txt:[0-9]* \(try_run\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt new file mode 100644 index 0000000..fb03571 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-run/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.24) +project(cxx_modules_try_run CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +try_run(can_run_modules_result can_compile_modules + SOURCES_TYPE CXX_MODULE + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/importable.cxx" + SOURCES_TYPE NORMAL + SOURCE_FROM_FILE + main.cxx "${CMAKE_CURRENT_LIST_DIR}/main.cxx" + CXX_STANDARD 20) + +if (NOT can_compile_modules) + message(FATAL_ERROR + "`try_run` could not compile sources using modules.") +endif () + +if (can_run_modules_result) + message(FATAL_ERROR + "`try_run` could not run sources using modules.") +endif () diff --git a/Tests/RunCMake/CXXModules/examples/try-run/importable.cxx b/Tests/RunCMake/CXXModules/examples/try-run/importable.cxx new file mode 100644 index 0000000..607680a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-run/importable.cxx @@ -0,0 +1,6 @@ +export module importable; + +export int from_import() +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/try-run/main.cxx b/Tests/RunCMake/CXXModules/examples/try-run/main.cxx new file mode 100644 index 0000000..5c1bb42 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/try-run/main.cxx @@ -0,0 +1,6 @@ +import importable; + +int main(int argc, char* argv[]) +{ + return from_import() == 1; +} diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt deleted file mode 100644 index 9080942..0000000 --- a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Warning: - The "Visual Studio 11 2012" generator is deprecated and will be removed in - a future version of CMake. - - Add CMAKE_WARN_VS11=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-OFF.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-OFF.cmake diff --git a/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON-stderr.txt new file mode 100644 index 0000000..b69408e --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning: + The "Visual Studio 12 2013" generator is deprecated and will be removed in + a future version of CMake. + + Add CMAKE_WARN_VS12=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON.cmake diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 45b4c0e..611dde2 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -1119,9 +1119,9 @@ if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 2008") run_cmake_with_options(DeprecateVS9-WARN-OFF -DCMAKE_WARN_VS9=OFF) endif() -if(RunCMake_GENERATOR MATCHES "^Visual Studio 11 2012") - run_cmake_with_options(DeprecateVS11-WARN-ON -DCMAKE_WARN_VS11=ON) - unset(ENV{CMAKE_WARN_VS11}) - run_cmake(DeprecateVS11-WARN-ON) - run_cmake_with_options(DeprecateVS11-WARN-OFF -DCMAKE_WARN_VS11=OFF) +if(RunCMake_GENERATOR MATCHES "^Visual Studio 12 2013") + run_cmake_with_options(DeprecateVS12-WARN-ON -DCMAKE_WARN_VS12=ON) + unset(ENV{CMAKE_WARN_VS12}) + run_cmake(DeprecateVS12-WARN-ON) + run_cmake_with_options(DeprecateVS12-WARN-OFF -DCMAKE_WARN_VS12=OFF) endif() diff --git a/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt new file mode 100644 index 0000000..9a7d746 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt @@ -0,0 +1,2 @@ +-- env_emulator='pseudo_emulator(\.exe)?' +-- emulator='pseudo_emulator(\.exe)?' diff --git a/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake new file mode 100644 index 0000000..55fc483 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake @@ -0,0 +1,6 @@ +message(STATUS "ENV{CMAKE_CROSS_COMPILING_EMULATOR}='$ENV{CMAKE_CROSSCOMPILING_EMULATOR}'") +message(STATUS "CMAKE_CROSSCOMPLING_EMULATOR='${CMAKE_CROSSCOMPILING_EMULATOR}'") +get_filename_component(env_emulator "$ENV{CMAKE_CROSSCOMPILING_EMULATOR}" NAME) +message(STATUS "env_emulator='${env_emulator}'") +get_filename_component(emulator "${CMAKE_CROSSCOMPILING_EMULATOR}" NAME) +message(STATUS "emulator='${emulator}'") diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake index 97b7b5a..1ffd91c 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -26,3 +26,11 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR_CUSTOM_COMMAND_ARG}\;custom_argument") CustomCommandGenerator_run_and_build(AddCustomCommandWithArg) CustomCommandGenerator_run_and_build(AddCustomTargetWithArg) +unset(RunCMake_TEST_OPTIONS) + +function(run_EnvCrossCompilingEmulator) + set(ENV{CMAKE_CROSSCOMPILING_EMULATOR} "${PSEUDO_EMULATOR}") + run_cmake(EnvCrossCompilingEmulator) + unset(ENV{CMAKE_CROSSCOMPILING_EMULATOR}) +endfunction() +run_EnvCrossCompilingEmulator() diff --git a/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake b/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake index 891e138..6847a23 100644 --- a/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake +++ b/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake @@ -59,3 +59,5 @@ run_optimize_test(OptimizeStatic StaticTop) if(CMAKE_Fortran_COMPILER) run_optimize_test(OptimizeFortran FortranTop) endif() + +run_cmake_build(RuntimeTargets mylib SharedTop) diff --git a/Tests/RunCMake/DependencyGraph/RuntimeTargets.cmake b/Tests/RunCMake/DependencyGraph/RuntimeTargets.cmake new file mode 100644 index 0000000..21531cd --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/RuntimeTargets.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +set(CMAKE_OPTIMIZE_DEPENDENCIES TRUE) +add_library(mylib STATIC mylib.c) +add_library(neverbuild SHARED neverbuild.c) + +# Building mylib should not require building neverbuild +target_link_libraries(mylib PRIVATE neverbuild) +set_target_properties(neverbuild PROPERTIES EXCLUDE_FROM_ALL YES) + +# Building SharedTop should require SharedBottom to be built +add_library(SharedTop SHARED top.c) +add_library(StaticMiddle STATIC middle.c) +add_library(SharedBottom SHARED bottom.c) +target_link_libraries(SharedTop PRIVATE StaticMiddle) +target_link_libraries(StaticMiddle PRIVATE SharedBottom) +set_target_properties(StaticMiddle SharedBottom PROPERTIES EXCLUDE_FROM_ALL YES) +set_target_properties(StaticMiddle PROPERTIES POSITION_INDEPENDENT_CODE YES) diff --git a/Tests/RunCMake/DependencyGraph/bottom.c b/Tests/RunCMake/DependencyGraph/bottom.c new file mode 100644 index 0000000..c8ea481 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/bottom.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int bottom(void) +{ + return 23; +} diff --git a/Tests/RunCMake/DependencyGraph/middle.c b/Tests/RunCMake/DependencyGraph/middle.c new file mode 100644 index 0000000..3b1b84c --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/middle.c @@ -0,0 +1,9 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + int bottom(void); + +int middle(void) +{ + return bottom() + 19; +} diff --git a/Tests/RunCMake/DependencyGraph/neverbuild.c b/Tests/RunCMake/DependencyGraph/neverbuild.c new file mode 100644 index 0000000..e490510 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/neverbuild.c @@ -0,0 +1 @@ +#error I should not be built diff --git a/Tests/RunCMake/DependencyGraph/top.c b/Tests/RunCMake/DependencyGraph/top.c new file mode 100644 index 0000000..eceb0a5 --- /dev/null +++ b/Tests/RunCMake/DependencyGraph/top.c @@ -0,0 +1,9 @@ +int middle(void); + +#ifdef _WIN32 +__declspec(dllexport) +#endif + int top(void) +{ + return middle() + 2; +} diff --git a/Tests/RunCMake/ExternalProject/DetectJobServer.cmake b/Tests/RunCMake/ExternalProject/DetectJobServer.cmake new file mode 100644 index 0000000..c6e1412 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DetectJobServer.cmake @@ -0,0 +1,16 @@ +include(ExternalProject) +ExternalProject_Add(Foo + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Foo + BUILD_COMMAND ${DETECT_JOBSERVER} "ep.txt" + BUILD_JOB_SERVER_AWARE 1 + INSTALL_COMMAND "" +) + +# Add a second step to test JOB_SERVER_AWARE +ExternalProject_Add_Step(Foo + second_step + COMMAND ${DETECT_JOBSERVER} "ep_second_step.txt" + DEPENDEES build + ALWAYS 1 + JOB_SERVER_AWARE 1 +) diff --git a/Tests/RunCMake/ExternalProject/Foo/CMakeLists.txt b/Tests/RunCMake/ExternalProject/Foo/CMakeLists.txt new file mode 100644 index 0000000..b38b173 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Foo/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.27) +project(Foo NONE) + +add_custom_target(drive ALL COMMAND ${CMAKE_COMMAND} -E true) diff --git a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake new file mode 100644 index 0000000..55a9f0d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware-check.cmake @@ -0,0 +1,16 @@ +set(BUILD_DIR "${RunCMake_BINARY_DIR}/GNUMakeJobServerAware-build") + +function(check target regex) + file(STRINGS ${BUILD_DIR}/${target} lines + REGEX ${regex} + ) + + list(LENGTH lines len) + if(len EQUAL 0) + message(FATAL_ERROR "Could not find matching lines '${regex}' in ${BUILD_DIR}/${target}") + endif() +endfunction() + +check("/CMakeFiles/Foo.dir/build.make" [[\+cd (/d )?"?.*"? && "?.*"? --build "?.*"?]]) +check("/CMakeFiles/Foo.dir/build.make" [[\+cd (/d )?"?.*"? && "?.*"? -E touch "?.*"?]]) +check("/CMakeFiles/Foo.dir/build.make" [[\+"?.*"? -E true]]) diff --git a/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake new file mode 100644 index 0000000..3f688ca --- /dev/null +++ b/Tests/RunCMake/ExternalProject/GNUMakeJobServerAware.cmake @@ -0,0 +1,16 @@ +include(ExternalProject) +ExternalProject_Add(Foo + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Foo + BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> + BUILD_JOB_SERVER_AWARE 1 + INSTALL_COMMAND "" +) + +# Add a second step to test JOB_SERVER_AWARE +ExternalProject_Add_Step(Foo + second_step + COMMAND ${CMAKE_COMMAND} -E true + DEPENDEES build + ALWAYS 1 + JOB_SERVER_AWARE 1 +) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 4afdef8..ffaa46c 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -144,6 +144,24 @@ function(__ep_test_with_build_with_server testName) run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) endfunction() +if(RunCMake_GENERATOR MATCHES "(MSYS|MinGW|Unix) Makefiles") + __ep_test_with_build(GNUMakeJobServerAware) +endif() + +function(__ep_test_jobserver) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DetectJobServer-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake_with_options(DetectJobServer -DDETECT_JOBSERVER=${DETECT_JOBSERVER}) + run_cmake_command(DetectJobServer-clean ${CMAKE_COMMAND} --build . --target clean) + run_cmake_command(DetectJobServer-build ${CMAKE_COMMAND} --build . -j4) +endfunction() + +if(RunCMake_GENERATOR MATCHES "(MinGW|Unix) Makefiles") + __ep_test_jobserver() +endif() + __ep_test_with_build(MultiCommand) set(RunCMake_TEST_OUTPUT_MERGE 1) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json index 521e464..93df8a6 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json @@ -73,6 +73,47 @@ { "define": "interface_exe_EXPORTS", "backtrace": null + }, + { + "define": "COMPILED_WITH_INTERFACE_LIB", + "backtrace": [ + { + "file": "^include_test\\.cmake$", + "line": 4, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^include_test\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] } ], "compileCommandFragments": null diff --git a/Tests/RunCMake/FileAPI/include_test.cmake b/Tests/RunCMake/FileAPI/include_test.cmake index c74d264..c188cb3 100644 --- a/Tests/RunCMake/FileAPI/include_test.cmake +++ b/Tests/RunCMake/FileAPI/include_test.cmake @@ -1,7 +1,7 @@ add_library(interface_lib INTERFACE) target_compile_definitions(interface_lib INTERFACE COMPILED_WITH_INTERFACE_LIB) add_executable(interface_exe empty.c) -target_link_libraries(interface_exe PRIVATE inteface_lib) +target_link_libraries(interface_exe PRIVATE interface_lib) set_property(TARGET interface_exe PROPERTY ENABLE_EXPORTS ON) set_property(TARGET interface_exe PROPERTY RUNTIME_OUTPUT_DIRECTORY bin) set_property(TARGET interface_exe PROPERTY ARCHIVE_OUTPUT_DIRECTORY lib) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt deleted file mode 100644 index 539e5ef..0000000 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt +++ /dev/null @@ -1,3 +0,0 @@ --- ZOT_LIBRARIES='zot' --- ZOT_LINK_LIBRARIES='[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/root/lib/prefix-zot-suffix' --- ZOT_LDFLAGS='-L[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/root/lib;-lzot' diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-stdout.txt new file mode 100644 index 0000000..012458d --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-stdout.txt @@ -0,0 +1,4 @@ +-- ZOT_LIBRARIES='zot' +-- ZOT_LINK_LIBRARIES='[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-build/root/lib/prefix-zot-suffix' +-- ZOT_LDFLAGS='-L[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-build/root/lib;-lzot' +-- ZOT_CFLAGS='-I[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-build/root/include' diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH.cmake index 1278c49..e58cefb 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH.cmake @@ -3,16 +3,19 @@ find_package(PkgConfig REQUIRED) set(ROOT "${CMAKE_CURRENT_BINARY_DIR}/root") string(REPLACE " " "\\ " ESCAPED_ROOT "${ROOT}") set(LIB_DIR "${ROOT}/lib") +set(INCLUDE_DIR "${ROOT}/include") set(PKGCONFIG_DIR "${LIB_DIR}/pkgconfig") file(WRITE "${PKGCONFIG_DIR}/zot.pc" " prefix=${ESCAPED_ROOT} libdir=\${prefix}/lib +includedir=\${prefix}/include Name: Zot Description: Dummy package to test LIBRARY_DIR support Version: 1.0 Libs: -L\${libdir} -lzot +Cflags: -I\${includedir} ") # Create a "library" file to find in libdir. @@ -22,9 +25,13 @@ file(WRITE "${LIB_DIR}/prefix-zot-suffix") # 'pkg-config --libs' drops -L flags in PKG_CONFIG_SYSTEM_LIBRARY_PATH by default. set(ENV{PKG_CONFIG_SYSTEM_LIBRARY_PATH} "${LIB_DIR}") +# 'pkg-config --cflags' drops -I flags in PKG_CONFIG_SYSTEM_INCLUDE_PATH by default. +set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "${INCLUDE_DIR}") # 'pkgconf --libs' also drops -L flags in LIBRARY_PATH by default. set(ENV{LIBRARY_PATH} "${LIB_DIR}") +# 'pkgconf --cflags' also drops -I flags in CPATH by default. +set(ENV{CPATH} "${INCLUDE_DIR}") set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_DIR}") pkg_check_modules(ZOT REQUIRED zot) @@ -32,3 +39,4 @@ pkg_check_modules(ZOT REQUIRED zot) message(STATUS "ZOT_LIBRARIES='${ZOT_LIBRARIES}'") message(STATUS "ZOT_LINK_LIBRARIES='${ZOT_LINK_LIBRARIES}'") message(STATUS "ZOT_LDFLAGS='${ZOT_LDFLAGS}'") +message(STATUS "ZOT_CFLAGS='${ZOT_CFLAGS}'") diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index 6b8e884..2bfe028 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -59,6 +59,6 @@ Libs: -L\${libdir} run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME) run_cmake(FindPkgConfig_empty_target) if(NOT PKG_CONFIG_DONT_SUPPORT_SPACES_IN_PATH) - run_cmake(FindPkgConfig_LIBRARY_PATH) + run_cmake(FindPkgConfig_SYSTEM_PATH) endif() endif () diff --git a/Tests/RunCMake/Framework/FrameworkConsumption.cmake b/Tests/RunCMake/Framework/FrameworkConsumption.cmake index 2180cf9..f831a94 100644 --- a/Tests/RunCMake/Framework/FrameworkConsumption.cmake +++ b/Tests/RunCMake/Framework/FrameworkConsumption.cmake @@ -1,5 +1,7 @@ enable_language(C) +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install") + # Create framework and ensure header is placed in Headers set(input_header "${CMAKE_SOURCE_DIR}/Gui.h") add_library(Gui SHARED Gui.c "${input_header}") @@ -8,6 +10,8 @@ set_target_properties(Gui PROPERTIES FRAMEWORK TRUE ) +install(TARGETS Gui DESTINATION .) + add_executable(app main.c) target_link_libraries(app PRIVATE Gui) diff --git a/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake b/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake index bcf6c29..94c0b87 100644 --- a/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake +++ b/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake @@ -22,3 +22,15 @@ set_target_properties(Example::Example2 PROPERTIES add_library(testcase2 FrameworkSystemIncludeTest.c) target_compile_options(testcase2 PRIVATE "-Werror=#pragma-messages") target_link_libraries(testcase2 PRIVATE Example::Example2) + + + +add_library(Example::Example3 SHARED IMPORTED) +set_target_properties(Example::Example3 PROPERTIES + FRAMEWORK 1 + IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/subdir/Example.framework" +) + +add_library(testcase3 FrameworkSystemIncludeTest.c) +target_compile_options(testcase3 PRIVATE "-Werror=#pragma-messages") +target_link_libraries(testcase3 PRIVATE Example::Example3) diff --git a/Tests/RunCMake/Framework/ImportedFrameworkConsumption.cmake b/Tests/RunCMake/Framework/ImportedFrameworkConsumption.cmake new file mode 100644 index 0000000..c44a1bb --- /dev/null +++ b/Tests/RunCMake/Framework/ImportedFrameworkConsumption.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_library(Gui IMPORTED UNKNOWN) +set_property(TARGET Gui PROPERTY IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/../FrameworkConsumption-build/install/Gui.framework") + +add_executable(app main.c) +target_link_libraries(app PRIVATE Gui) diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index a767130..7319a59 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -113,7 +113,16 @@ function(framework_consumption) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(FrameworkConsumption) - run_cmake_command(FrameworkConsumption-build ${CMAKE_COMMAND} --build .) + run_cmake_command(FrameworkConsumption-build ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(FrameworkConsumption-install ${CMAKE_COMMAND} --install . --config Release) + + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ImportedFrameworkConsumption-build") + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(ImportedFrameworkConsumption) + run_cmake_command(ImportedFrameworkConsumption-build ${CMAKE_COMMAND} --build . --config Release) endfunction() framework_consumption() diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1-stderr.txt new file mode 100644 index 0000000..61188b6 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Xcode + + toolset specification field + + buildsystem=1 + + is not allowed with Xcode [0-9.]+\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem1.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index a742391..71cc2d4 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -89,7 +89,11 @@ elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode") set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolsetXcodeBuildSystemDefault12) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,buildsystem=1") - run_cmake(TestToolsetXcodeBuildSystem1) + if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + run_cmake(BadToolsetXcodeBuildSystem1) + else() + run_cmake(TestToolsetXcodeBuildSystem1) + endif() set(RunCMake_GENERATOR_TOOLSET "Test Toolset,buildsystem=12") run_cmake(TestToolsetXcodeBuildSystem12) else() diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt new file mode 100644 index 0000000..4499d97 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0117-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0117 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Make/DetectJobServer-present.cmake b/Tests/RunCMake/Make/DetectJobServer-present.cmake new file mode 100644 index 0000000..cfaf7be --- /dev/null +++ b/Tests/RunCMake/Make/DetectJobServer-present.cmake @@ -0,0 +1,13 @@ +# Verifies that the jobserver is present +add_custom_command(OUTPUT custom_command.txt + JOB_SERVER_AWARE ON + COMMENT "Should detect jobserver support" + COMMAND ${DETECT_JOBSERVER} "custom_command.txt" +) + +# trigger the custom command to run +add_custom_target(dummy ALL + JOB_SERVER_AWARE ON + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/custom_command.txt + COMMAND ${DETECT_JOBSERVER} "custom_target.txt" +) diff --git a/Tests/RunCMake/Make/Foo/CMakeLists.txt b/Tests/RunCMake/Make/Foo/CMakeLists.txt new file mode 100644 index 0000000..baa6634 --- /dev/null +++ b/Tests/RunCMake/Make/Foo/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.26) +project(Foo NONE) + +add_custom_target(drive ALL COMMAND ${CMAKE_COMMAND} -E true) diff --git a/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake b/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake new file mode 100644 index 0000000..dbc1555 --- /dev/null +++ b/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake @@ -0,0 +1,18 @@ +set(BUILD_DIR "${RunCMake_BINARY_DIR}/GNUMakeJobServerAware-build") + +function(check target regex) + file(STRINGS ${BUILD_DIR}/${target} lines + REGEX ${regex} + ) + + list(LENGTH lines len) + if(len EQUAL 0) + message(FATAL_ERROR "Could not find matching lines '${regex}' in ${BUILD_DIR}/${target}") + endif() +endfunction() + +check("CMakeFiles/dummy.dir/build.make" [[\+\$\(CMAKE_COMMAND\) -E true]]) +check("CMakeFiles/dummy2.dir/build.make" [[\+\$\(CMAKE_COMMAND\) -E true]]) + +check("CMakeFiles/dummy3.dir/build.make" [[\+cd (/d )?"?.*"? && \$\(CMAKE_COMMAND\) -E true]]) +check("CMakeFiles/dummy4.dir/build.make" [[\+cd (/d )?"?.*"? && \$\(CMAKE_COMMAND\) -E true]]) diff --git a/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake b/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake new file mode 100644 index 0000000..d92e842 --- /dev/null +++ b/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake @@ -0,0 +1,31 @@ +# Test JOB_SERVER_AWARE with custom commands +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/missing" + JOB_SERVER_AWARE ON + COMMAND $(CMAKE_COMMAND) -E true +) +add_custom_target(dummy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/missing") + +# Test JOB_SERVER_AWARE with custom targets +add_custom_target( + dummy2 ALL + JOB_SERVER_AWARE ON + COMMAND $(CMAKE_COMMAND) -E true +) + +# Test JOB_SERVER_AWARE with custom commands with WORKING_DIRECTORY +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/missing2" + JOB_SERVER_AWARE ON + COMMAND $(CMAKE_COMMAND) -E true + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Foo" +) +add_custom_target(dummy3 ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/missing2") + +# Test JOB_SERVER_AWARE with custom targets with WORKING_DIRECTORY +add_custom_target( + dummy4 ALL + JOB_SERVER_AWARE ON + COMMAND $(CMAKE_COMMAND) -E true + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Foo" +) diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index c7717ec..5d1ba48 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -70,3 +70,22 @@ if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_CMP0113(OLD) run_CMP0113(NEW) endif() + +function(detect_jobserver_present) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DetectJobServer-present-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DDETECT_JOBSERVER=${DETECT_JOBSERVER}") + run_cmake(DetectJobServer-present) + run_cmake_command(DetectJobServer-present-parallel-build ${CMAKE_COMMAND} --build . -j4) +endfunction() + +# Jobservers are currently only supported by GNU makes, except MSYS2 make +if(MAKE_IS_GNU AND NOT RunCMake_GENERATOR MATCHES "MSYS Makefiles") + detect_jobserver_present() +endif() + +if(MAKE_IS_GNU) + # In GNU makes, `JOB_SERVER_AWARE` support is implemented by prefixing + # commands with the '+' operator. + run_cmake(GNUMakeJobServerAware) +endif() diff --git a/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt b/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt new file mode 100644 index 0000000..6024984 --- /dev/null +++ b/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at QtSubDir1/CMakeLists\.txt:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index bc4a330..3e5ddc5 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -145,7 +145,19 @@ function(run_cmake test) ${maybe_timeout} ${maybe_input_file} )]]) + if(DEFINED ENV{PWD}) + set(old_pwd "$ENV{PWD}") + else() + set(old_pwd) + endif() + # Emulate a shell using this directory. + set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}") cmake_language(EVAL CODE "${_code}") + if(DEFINED old_pwd) + set(ENV{PWD} "${old_pwd}") + else() + set(ENV{PWD}) + endif() set(msg "") if(NOT "${actual_result}" MATCHES "${expect_result}") string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n") diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake index 58a111a..12f004b 100644 --- a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake +++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake @@ -29,8 +29,6 @@ function (run_symlink_test case src bin src_from_bin bin_from_src) # Test running in binary directory. set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - # Emulate a shell using this directory. - set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}") # Pass absolute path to the source tree, plain. set(RunCMake_TEST_VARIANT_DESCRIPTION " $abs/${name}/${src}") @@ -50,8 +48,6 @@ function (run_symlink_test case src bin src_from_bin bin_from_src) # Test running in source directory. set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") - # Emulate a shell using this directory. - set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}") # Pass absolute path to the binary tree with -B. set(RunCMake_TEST_VARIANT_DESCRIPTION " -B $abs/${name}/${bin}") @@ -63,8 +59,6 @@ function (run_symlink_test case src bin src_from_bin bin_from_src) # Test running in another directory. set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_BINARY_DIR}/${name}") - # Emulate a shell using this directory. - set(ENV{PWD} "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}") # Pass absolute paths to the source and binary trees. set(RunCMake_TEST_VARIANT_DESCRIPTION " -S $abs/${name}/${src} -B $abs/${name}/${bin}") diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake index c7a118f..537f67d 100644 --- a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake @@ -6,7 +6,7 @@ run_cmake(CMP0078-NEW) run_cmake(CMP0086-WARN) -if (CMake_TEST_FindPython) +if (CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) macro(run_cmake_target test subtest target) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt new file mode 100644 index 0000000..53f603e --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0120-OLD-Direct\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0120 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt new file mode 100644 index 0000000..fea708f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0120-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0120 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/XcFramework/CMakeLists.txt b/Tests/RunCMake/XcFramework/CMakeLists.txt new file mode 100644 index 0000000..54a4d62 --- /dev/null +++ b/Tests/RunCMake/XcFramework/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.26) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake new file mode 100644 index 0000000..22c28b4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake @@ -0,0 +1,107 @@ +include(RunCMake) + +function(create_library type platform system_name archs sysroot) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build) + run_cmake_with_options(create-${type}-${platform} -DCMAKE_SYSTEM_NAME=${system_name} -DCMAKE_OSX_ARCHITECTURES=${archs} -DCMAKE_OSX_SYSROOT=${sysroot} -DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(create-${type}-${platform}-build ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(create-${type}-${platform}-install ${CMAKE_COMMAND} --install . --config Release) +endfunction() + +function(create_libraries type) + create_library(${type} macos Darwin "${macos_archs_2}" macosx) + create_library(${type} ios iOS "arm64" iphoneos) + create_library(${type} tvos tvOS "arm64" appletvos) + create_library(${type} watchos watchOS "armv7k\\\\;arm64_32" watchos) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + create_library(${type} visionos visionOS "arm64" xros) + endif() + create_library(${type} ios-simulator iOS "${macos_archs_2}" iphonesimulator) + create_library(${type} tvos-simulator tvOS "${macos_archs_2}" appletvsimulator) + create_library(${type} watchos-simulator watchOS "${watch_sim_archs_2}" watchsimulator) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + create_library(${type} visionos-simulator visionOS "${macos_archs_2}" xrsimulator) + endif() +endfunction() + +function(create_xcframework name type platforms) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-xcframework-${name}-build) + set(args) + foreach(platform IN LISTS platforms) + if(type STREQUAL "framework") + list(APPEND args -framework ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/mylib.framework) + else() + list(APPEND args -library ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/libmylib.a -headers ${RunCMake_SOURCE_DIR}/mylib/include) + endif() + endforeach() + run_cmake_command(create-xcframework-${name} xcodebuild -create-xcframework ${args} -output ${RunCMake_TEST_BINARY_DIR}/mylib.xcframework) +endfunction() + +function(create_executable name xcfname system_name archs sysroot) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-executable-${name}-build) + run_cmake_with_options(create-executable-${name} -DCMAKE_SYSTEM_NAME=${system_name} -DCMAKE_OSX_ARCHITECTURES=${archs} -DCMAKE_OSX_SYSROOT=${sysroot} -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-${xcfname}-build/mylib.xcframework) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(create-executable-${name}-build ${CMAKE_COMMAND} --build . --config Release) +endfunction() + +function(create_executables name type) + create_executable(${name}-macos ${type} Darwin "${macos_archs_2}" macosx) + create_executable(${name}-ios ${type} iOS "arm64" iphoneos) + create_executable(${name}-tvos ${type} tvOS "arm64" appletvos) + create_executable(${name}-watchos ${type} watchOS "armv7k\\\\;arm64_32" watchos) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + create_executable(${name}-visionos ${type} visionOS "arm64" xros) + endif() + create_executable(${name}-ios-simulator ${type} iOS "${macos_archs_2}" iphonesimulator) + create_executable(${name}-tvos-simulator ${type} tvOS "${macos_archs_2}" appletvsimulator) + create_executable(${name}-watchos-simulator ${type} watchOS "${watch_sim_archs_2}" watchsimulator) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + create_executable(${name}-visionos-simulator ${type} visionOS "${macos_archs_2}" xrsimulator) + endif() +endfunction() + +set(xcframework_platforms macos ios tvos watchos ios-simulator tvos-simulator watchos-simulator) +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + list(APPEND xcframework_platforms visionos visionos-simulator) +endif() +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + set(macos_archs_1 "x86_64\\;arm64") + set(macos_archs_2 "x86_64\\\\;arm64") + set(watch_sim_archs_2 "x86_64") +else() + set(macos_archs_1 "x86_64") + set(macos_archs_2 "x86_64") + set(watch_sim_archs_2 "i386") +endif() + +create_libraries(library) +create_libraries(framework) +create_xcframework(library library "${xcframework_platforms}") +create_xcframework(framework framework "${xcframework_platforms}") +create_xcframework(incomplete framework "tvos;watchos") +create_executables(library library) +create_executables(framework framework) +run_cmake_with_options(create-executable-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +create_executables(target-library library) +create_executables(target-framework framework) +run_cmake_with_options(create-executable-target-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +if(RunCMake_GENERATOR STREQUAL "Xcode" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + create_executables(library-link-phase library) + create_executables(framework-link-phase framework) + run_cmake_with_options(create-executable-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) + create_executables(target-library-link-phase library) + create_executables(target-framework-link-phase framework) + run_cmake_with_options(create-executable-target-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +endif() + +# Ensure that .xcframework is found before .framework +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-xcframework-framework-build) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(copy-framework ${CMAKE_COMMAND} -E copy_directory ${RunCMake_BINARY_DIR}/create-framework-macos-build/install/lib/mylib.framework ${RunCMake_TEST_BINARY_DIR}/mylib.framework) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +run_cmake(find-library) +run_cmake_command(find-library-script ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/find-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-ios-simulator.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios-simulator.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos-simulator.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos-simulator.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos-simulator.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-tvos-simulator.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-visionos-simulator.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-watchos-simulator.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt new file mode 100644 index 0000000..5b43e19 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at create-executable\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-link-phase\.cmake:[0-9]+ \(include\) + create-executable-incomplete-link-phase\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt new file mode 100644 index 0000000..66b7d62 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at create-executable\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-incomplete\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake b/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-library-ios-simulator.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios-simulator.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos-simulator.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos-simulator.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos-simulator.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake new file mode 100644 index 0000000..2888c85 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-library-tvos-simulator.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-library-visionos-simulator.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-library-watchos-simulator.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake new file mode 100644 index 0000000..760d9d4 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake new file mode 100644 index 0000000..9884781 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake @@ -0,0 +1,2 @@ +include(create-executable.cmake) +set_property(TARGET myexe PROPERTY XCODE_LINK_BUILD_PHASE_MODE "KNOWN_LOCATION") diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-ios-simulator.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios-simulator.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos-simulator.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos-simulator.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos-simulator.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos-simulator.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos-simulator.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos-simulator.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt new file mode 100644 index 0000000..1308933 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at create-executable-target\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-target-link-phase\.cmake:[0-9]+ \(include\) + create-executable-target-incomplete-link-phase\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt new file mode 100644 index 0000000..716b17d --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at create-executable-target\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-target-incomplete\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake b/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-ios-simulator.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios-simulator.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos-simulator.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos-simulator.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos-simulator.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake new file mode 100644 index 0000000..dfeccb9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-tvos-simulator.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-visionos-simulator.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-watchos-simulator.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake new file mode 100644 index 0000000..b2e3469 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake new file mode 100644 index 0000000..9c0b0d5 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake @@ -0,0 +1,2 @@ +include(create-executable-target.cmake) +set_property(TARGET myexe PROPERTY XCODE_LINK_BUILD_PHASE_MODE "KNOWN_LOCATION") diff --git a/Tests/RunCMake/XcFramework/create-executable-target.cmake b/Tests/RunCMake/XcFramework/create-executable-target.cmake new file mode 100644 index 0000000..0cc356c --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target.cmake @@ -0,0 +1,21 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_library(mylib IMPORTED STATIC) +set_property(TARGET mylib PROPERTY IMPORTED_LOCATION ${MYLIB_LIBRARY}) + +add_executable(myexe myexe/myexe.c) +target_link_libraries(myexe PRIVATE mylib) diff --git a/Tests/RunCMake/XcFramework/create-executable.cmake b/Tests/RunCMake/XcFramework/create-executable.cmake new file mode 100644 index 0000000..6706b9f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_executable(myexe myexe/myexe.c) +target_link_libraries(myexe PRIVATE ${MYLIB_LIBRARY}) diff --git a/Tests/RunCMake/XcFramework/create-framework-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-framework-ios-simulator.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-framework-ios.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-ios.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-framework-macos.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-macos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-framework-tvos-simulator.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-framework-tvos.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-framework-visionos-simulator.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-framework-visionos.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-framework-watchos-simulator.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-framework-watchos.cmake new file mode 100644 index 0000000..8b7df9b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework.cmake b/Tests/RunCMake/XcFramework/create-framework.cmake new file mode 100644 index 0000000..f4406e6 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework.cmake @@ -0,0 +1,3 @@ +set(CMAKE_FRAMEWORK ON) +include(create-library-common.cmake) +install(FILES mylib/include/mylib/mylib.h DESTINATION lib/mylib.framework/Headers) diff --git a/Tests/RunCMake/XcFramework/create-library-common.cmake b/Tests/RunCMake/XcFramework/create-library-common.cmake new file mode 100644 index 0000000..958660d --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-common.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_library(mylib STATIC mylib/mylib.c) +install(TARGETS mylib DESTINATION lib) diff --git a/Tests/RunCMake/XcFramework/create-library-ios-simulator.cmake b/Tests/RunCMake/XcFramework/create-library-ios-simulator.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-ios-simulator.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-ios.cmake b/Tests/RunCMake/XcFramework/create-library-ios.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-ios.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-macos.cmake b/Tests/RunCMake/XcFramework/create-library-macos.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-macos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-tvos-simulator.cmake b/Tests/RunCMake/XcFramework/create-library-tvos-simulator.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-tvos-simulator.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-library-tvos.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-tvos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-visionos-simulator.cmake b/Tests/RunCMake/XcFramework/create-library-visionos-simulator.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-visionos-simulator.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-library-visionos.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-visionos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-watchos-simulator.cmake b/Tests/RunCMake/XcFramework/create-library-watchos-simulator.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-watchos-simulator.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-library-watchos.cmake new file mode 100644 index 0000000..a9f5dee --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-watchos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library.cmake b/Tests/RunCMake/XcFramework/create-library.cmake new file mode 100644 index 0000000..f2a5249 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library.cmake @@ -0,0 +1 @@ +include(create-library-common.cmake) diff --git a/Tests/RunCMake/XcFramework/find-library.cmake b/Tests/RunCMake/XcFramework/find-library.cmake new file mode 100644 index 0000000..c5fe8db --- /dev/null +++ b/Tests/RunCMake/XcFramework/find-library.cmake @@ -0,0 +1,5 @@ +find_library(MYLIB_XCFRAMEWORK mylib NO_DEFAULT_PATH PATHS "${CMAKE_BINARY_DIR}/../create-xcframework-framework-build") +file(REAL_PATH "${CMAKE_BINARY_DIR}/../create-xcframework-framework-build/mylib.xcframework" expected_path) +if(NOT MYLIB_XCFRAMEWORK STREQUAL expected_path) + message(FATAL_ERROR "Expected value of MYLIB_XCFRAMEWORK:\n ${expected_path}\nActual value:\n ${MYLIB_XCFRAMEWORK}") +endif() diff --git a/Tests/RunCMake/XcFramework/myexe/myexe.c b/Tests/RunCMake/XcFramework/myexe/myexe.c new file mode 100644 index 0000000..d04efbd --- /dev/null +++ b/Tests/RunCMake/XcFramework/myexe/myexe.c @@ -0,0 +1,7 @@ +#include <mylib/mylib.h> + +int main(void) +{ + mylib(); + return 0; +} diff --git a/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h b/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h new file mode 100644 index 0000000..1de07aa --- /dev/null +++ b/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h @@ -0,0 +1,3 @@ +#pragma once + +extern void mylib(void); diff --git a/Tests/RunCMake/XcFramework/mylib/mylib.c b/Tests/RunCMake/XcFramework/mylib/mylib.c new file mode 100644 index 0000000..4489684 --- /dev/null +++ b/Tests/RunCMake/XcFramework/mylib/mylib.c @@ -0,0 +1,3 @@ +void mylib(void) +{ +} diff --git a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c index 5e0f40f..c00fce7 100644 --- a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c +++ b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c @@ -5,6 +5,10 @@ # if __MAC_OS_X_VERSION_MIN_REQUIRED != __MAC_10_11 # error macOS deployment version mismatch # endif +#elif TARGET_OS_XR +# if __XR_OS_VERSION_MIN_REQUIRED != __XROS_1_0 +# error visionOS deployment version mismatch +# endif #elif TARGET_OS_IOS # if __IPHONE_OS_VERSION_MIN_REQUIRED != __IPHONE_9_1 # error iOS deployment version mismatch diff --git a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake index 234ceef..80e3877 100644 --- a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake +++ b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake @@ -7,6 +7,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +elseif(CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_OSX_DEPLOYMENT_TARGET "1.0") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") diff --git a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake index e2ed045..abb357b 100644 --- a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake @@ -93,6 +93,25 @@ if(NOT XCODE_VERSION VERSION_LESS 7.1) unset(RunCMake_TEST_OPTIONS) endif() +if(NOT XCODE_VERSION VERSION_LESS 15) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesVisionOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=visionOS" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build-visionOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-visionOS ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + if(NOT XCODE_VERSION VERSION_LESS 7) set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") run_cmake(XcodeTbdStub) @@ -242,6 +261,10 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8) deployment_target_test(tvOS appletvsimulator) deployment_target_test(watchOS watchos) deployment_target_test(watchOS watchsimulator) + if(XCODE_VERSION VERSION_GREATER_EQUAL 15) + deployment_target_test(visionOS xros) + deployment_target_test(visionOS xrsimulator) + endif() endif() if(XCODE_VERSION VERSION_GREATER_EQUAL 8) @@ -288,9 +311,11 @@ if (XCODE_VERSION VERSION_GREATER_EQUAL 7.3) endfunction() if(XCODE_VERSION VERSION_GREATER_EQUAL 12) - xctest_add_bundle_test(Darwin macosx "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") xctest_add_bundle_test(Darwin macosx "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - xctest_add_bundle_test(iOS iphonesimulator "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + if(XCODE_VERSION VERSION_LESS 14) + xctest_add_bundle_test(Darwin macosx "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(iOS iphonesimulator "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + endif() if (XCODE_VERSION VERSION_LESS 12.5) xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>") else() diff --git a/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake index a9fafd2..376a7fc 100644 --- a/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake @@ -9,7 +9,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") endif() -if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake index 576be11..66db44e 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake @@ -1,4 +1,3 @@ include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) -findAttribute(${test} "RemoveHeadersOnCopy" TRUE) findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake index 1bd1bd0..f5c9364 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake @@ -1,4 +1,4 @@ -add_executable(plug_in MACOS_BUNDLE Empty.txt) +add_executable(plug_in MACOSX_BUNDLE Empty.txt) set_target_properties(plug_in PROPERTIES LINKER_LANGUAGE CXX XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS-check.cmake new file mode 100644 index 0000000..75aaa91 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS-check.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "Embed Resources" TRUE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS.cmake new file mode 100644 index 0000000..54f9fc8 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedResources.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS-check.cmake new file mode 100644 index 0000000..75aaa91 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS-check.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "Embed Resources" TRUE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS.cmake new file mode 100644 index 0000000..54f9fc8 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedResources.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources.cmake new file mode 100644 index 0000000..0638037 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources.cmake @@ -0,0 +1,18 @@ +add_executable(app MACOSX_BUNDLE main.m) + +set(EMBED_RESOURCES_FOLDER ${CMAKE_BINARY_DIR}/runtime/shaders) + +# ensure embed resources folder exists +if (NOT (IS_DIRECTORY ${EMBED_RESOURCES_FOLDER})) + file(MAKE_DIRECTORY ${EMBED_RESOURCES_FOLDER}) +endif() + +set_target_properties(app PROPERTIES + XCODE_EMBED_RESOURCES_PATH ${EMBED_RESOURCES_FOLDER} +) + +set_target_properties(app PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app" +) diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake index a7bccee..3798ddc 100644 --- a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake @@ -83,6 +83,25 @@ function(TestExtensionKitExtension platform) ) endfunction() +function(TestEmbedCommon what platform) + set(testName Embed${what}-${platform}) + if(NOT platform STREQUAL "macOS") + set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=${platform}) + endif() + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(${testName}) + run_cmake_command(${testName}-build + ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} + --config Debug + --target app + ) +endfunction() + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) @@ -100,4 +119,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 14.1) # defaults, which is to remove headers on copy, but not code sign. TestAppExtension(macOS) TestAppExtension(iOS) + TestEmbedCommon(Resources macOS) + TestEmbedCommon(Resources iOS) + TestEmbedCommon(PlugIns macOS) endif() diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty-stdout.txt b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty-stdout.txt new file mode 100644 index 0000000..d5a0ca8 --- /dev/null +++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty-stdout.txt @@ -0,0 +1 @@ +MSYSTEM_PREFIX='' diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty.cmake b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty.cmake new file mode 100644 index 0000000..ac36c8d --- /dev/null +++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty.cmake @@ -0,0 +1,3 @@ +unset(ENV{MSYSTEM}) +cmake_host_system_information(RESULT result QUERY MSYSTEM_PREFIX) +message(STATUS "MSYSTEM_PREFIX='${result}'") diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-result.txt b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-stderr.txt b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-stderr.txt new file mode 100644 index 0000000..89c4e9b --- /dev/null +++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake:[0-9]+ \(cmake_host_system_information\): + cmake_host_system_information does not recognize <key> MSYSTEM_PREFIX$ diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake new file mode 100644 index 0000000..dc1def3 --- /dev/null +++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake @@ -0,0 +1,2 @@ +unset(ENV{MSYSTEM}) +cmake_host_system_information(RESULT result QUERY MSYSTEM_PREFIX) diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-stdout.txt b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-stdout.txt new file mode 100644 index 0000000..f6e2549 --- /dev/null +++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-stdout.txt @@ -0,0 +1,2 @@ +-- MSYSTEM_PREFIX='[^ +]+' diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX.cmake b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX.cmake new file mode 100644 index 0000000..d1c996b --- /dev/null +++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX.cmake @@ -0,0 +1,7 @@ +cmake_host_system_information(RESULT result QUERY MSYSTEM_PREFIX) +message(STATUS "MSYSTEM_PREFIX='${result}'") +if(CMake_TEST_MSYSTEM_PREFIX) + if(NOT "${result}" STREQUAL "${CMake_TEST_MSYSTEM_PREFIX}") + message(FATAL_ERROR "Actual result:\n ${result}\nis not expected result:\n ${CMake_TEST_MSYSTEM_PREFIX}") + endif() +endif() diff --git a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake index 9122470..0b3576d 100644 --- a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake @@ -22,6 +22,17 @@ else() run_cmake(VsMSBuildMissing) endif() +if(CMAKE_HOST_WIN32) + run_cmake_script(MSYSTEM_PREFIX-Empty) + if("$ENV{MSYSTEM}" MATCHES "(MSYS|MINGW32|MINGW64|UCRT64)") + set(RunCMake_TEST_VARIANT_DESCRIPTION "-$ENV{MSYSTEM}") + run_cmake_script(MSYSTEM_PREFIX -DCMake_TEST_MSYSTEM_PREFIX=${CMake_TEST_MSYSTEM_PREFIX}) + unset(RunCMake_TEST_VARIANT_DESCRIPTION) + endif() +else() + run_cmake_script(MSYSTEM_PREFIX-Missing) +endif() + # WINDOWS_REGISTRY tests run_cmake(Registry_NoArgs) run_cmake(Registry_BadQuery1) diff --git a/Tests/RunCMake/ctest_build/BuildFailure.cxx b/Tests/RunCMake/ctest_build/BuildFailure.cxx new file mode 100644 index 0000000..8102883 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure.cxx @@ -0,0 +1,4 @@ +int main() +{ + this code will not compile +} diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index 12525f2..af56ead 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -13,18 +13,18 @@ endfunction() run_ctest_build(BuildQuiet QUIET) run_ctest_build(ParallelLevel PARALLEL_LEVEL 1) -function(run_BuildFailure) - set(CASE_CMAKELISTS_SUFFIX_CODE [[ -add_custom_target(BuildFailure ALL COMMAND command-does-not-exist) -]]) +block() + set(LANG CXX) + configure_file("${RunCMake_SOURCE_DIR}/BuildFailure.cxx" "${RunCMake_BINARY_DIR}/BuildFailure/BuildFailure.cxx" COPYONLY) + set(CASE_CMAKELISTS_SUFFIX_CODE [=[ + add_executable(BuildFailure BuildFailure.cxx) + ]=]) set(CASE_CMAKELISTS_PREFIX_CODE [[ if(NOT CTEST_USE_LAUNCHERS) message(FATAL_ERROR "CTEST_USE_LAUNCHERS not set") endif() ]]) - set(CASE_TEST_PREFIX_CODE [[ -cmake_policy(SET CMP0061 NEW) -]]) + set(CASE_TEST_PREFIX_CODE "") set(CASE_TEST_SUFFIX_CODE [[ if (ctest_build_return_value) message("ctest_build returned non-zero") @@ -35,13 +35,16 @@ endif() run_ctest(BuildFailure) if (RunCMake_GENERATOR MATCHES "Makefiles") + set(LANG NONE) set(CASE_TEST_PREFIX_CODE [[ cmake_policy(VERSION 3.2) ]]) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_custom_target(BuildFailure ALL COMMAND command-does-not-exist) +]]) run_ctest(BuildFailure-CMP0061-OLD) endif() -endfunction() -run_BuildFailure() +endblock() function(run_BuildChangeId) set(CASE_TEST_PREFIX_CODE [[ diff --git a/Tests/RunCMake/ctest_test/NotRun-result.txt b/Tests/RunCMake/ctest_test/NotRun-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_test/NotRun-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_test/NotRun-stderr.txt b/Tests/RunCMake/ctest_test/NotRun-stderr.txt new file mode 100644 index 0000000..85907f3 --- /dev/null +++ b/Tests/RunCMake/ctest_test/NotRun-stderr.txt @@ -0,0 +1,2 @@ +.*Unable to find executable[^ +]*does_not_exist diff --git a/Tests/RunCMake/ctest_test/NotRun-stdout.txt b/Tests/RunCMake/ctest_test/NotRun-stdout.txt new file mode 100644 index 0000000..8d60833 --- /dev/null +++ b/Tests/RunCMake/ctest_test/NotRun-stdout.txt @@ -0,0 +1,7 @@ +.*Could not find executable[^ +]*does_not_exist +.* +50% tests passed, 1 tests failed out of 2 +.* +The following tests FAILED: +.*testNotRun \(Not Run\) diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 242a059..d2f3da3 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -53,6 +53,13 @@ unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) unset(CASE_CTEST_TEST_LOAD) unset(RunCTest_VERBOSE_FLAG) +block() + set(CASE_CMAKELISTS_SUFFIX_CODE [[ + add_test(NAME testNotRun COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist) + ]]) + run_ctest_test(NotRun) +endblock() + function(run_TestChangeId) set(CASE_TEST_PREFIX_CODE [[ set(CTEST_CHANGE_ID "<>1") @@ -131,8 +138,7 @@ run_TestRepeat(AfterTimeout RETURN_VALUE:0 REPEAT AFTER_TIMEOUT:3) # test repeat and not run tests interact correctly set(CASE_CMAKELISTS_SUFFIX_CODE [[ -add_test(NAME testNotRun - COMMAND ${CMAKE_COMMAND}/doesnt_exist) + add_test(NAME testNotRun COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist) set_property(TEST testNotRun PROPERTY TIMEOUT 5) ]]) run_TestRepeat(NotRun RETURN_VALUE:1 REPEAT UNTIL_PASS:3) diff --git a/Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt b/Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt index a69932d..85907f3 100644 --- a/Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt +++ b/Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt @@ -1 +1,2 @@ -.*Unable to find executable.* +.*Unable to find executable[^ +]*does_not_exist diff --git a/Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt b/Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt index 72c98bc..8d60833 100644 --- a/Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt +++ b/Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt @@ -1,5 +1,7 @@ +.*Could not find executable[^ +]*does_not_exist .* 50% tests passed, 1 tests failed out of 2 .* The following tests FAILED: -.*testNotRun.*Not Run.* +.*testNotRun \(Not Run\) diff --git a/Tests/RunCMake/detect_jobserver.c b/Tests/RunCMake/detect_jobserver.c new file mode 100644 index 0000000..8cbfe2e --- /dev/null +++ b/Tests/RunCMake/detect_jobserver.c @@ -0,0 +1,179 @@ +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1928 +# pragma warning(disable : 5105) /* macro expansion warning in windows.h */ +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define MAX_MESSAGE_LENGTH 1023 +#define USAGE "Usage: %s <output_file>\n" + +// Extracts the jobserver details from the MAKEFLAGS environment variable. +// +// Returns a pointer to either a string of the form "R,W" where R and W are fds +// or "fifo:PATH". +// +// Returns NULL if MAKEFLAGS is not set or does not contain recognized +// jobserver flags. +char* jobserver_auth(char* message) +{ + const char* jobserver_flags[3] = { "--jobserver-auth=", "--jobserver-fds=", + "-J" }; + char* start = NULL; + char* end; + char* result; + size_t len; + int i; + + char* makeflags = getenv("MAKEFLAGS"); + if (makeflags == NULL) { + strncpy(message, "MAKEFLAGS not set", MAX_MESSAGE_LENGTH); + return NULL; + } + + fprintf(stdout, "MAKEFLAGS: %s\n", makeflags); + + for (i = 0; i < 3; i++) { + start = strstr(makeflags, jobserver_flags[i]); + if (start != NULL) { + start += strlen(jobserver_flags[i]); + break; + } + } + + if (start == NULL) { + strncpy(message, "No jobserver flags found", MAX_MESSAGE_LENGTH); + return NULL; + } + + // Skip leading white space + while (*start == ' ' || *start == '\t') { + start++; + } + + end = strchr(start, ' '); + if (end == NULL) { + end = start + strlen(start); + } + len = (size_t)(end - start); + result = (char*)malloc(len + 1); + strncpy(result, start, len); + result[len] = '\0'; + + return result; +} + +#if defined(_WIN32) +# include <windows.h> + +int windows_semaphore(const char* semaphore, char* message) +{ + // Open the semaphore + HANDLE hSemaphore = OpenSemaphoreA(SEMAPHORE_ALL_ACCESS, FALSE, semaphore); + + if (hSemaphore == NULL) { +# if defined(_MSC_VER) && _MSC_VER < 1900 + sprintf(message, "Error opening semaphore: %s (%ld)\n", semaphore, + GetLastError()); +# else + snprintf(message, MAX_MESSAGE_LENGTH, + "Error opening semaphore: %s (%ld)\n", semaphore, GetLastError()); +# endif + return 1; + } + + strncpy(message, "Success", MAX_MESSAGE_LENGTH); + return 0; +} +#else +# include <errno.h> +# include <fcntl.h> + +int test_fd(int read_fd, int write_fd, char* message) +{ + // Detect if the file descriptors are valid + int read_good = fcntl(read_fd, F_GETFD) != -1; + int read_error = errno; + + int write_good = fcntl(write_fd, F_GETFD) != -1; + int write_error = errno; + + if (!read_good || !write_good) { + snprintf(message, MAX_MESSAGE_LENGTH, + "Error opening file descriptors: %d (%s), %d (%s)\n", read_fd, + strerror(read_error), write_fd, strerror(write_error)); + return 1; + } + + snprintf(message, MAX_MESSAGE_LENGTH, "Success\n"); + return 0; +} + +int posix(const char* jobserver, char* message) +{ + int read_fd; + int write_fd; + const char* path; + + // First try to parse as "R,W" file descriptors + if (sscanf(jobserver, "%d,%d", &read_fd, &write_fd) == 2) { + return test_fd(read_fd, write_fd, message); + } + + // Then try to parse as "fifo:PATH" + if (strncmp(jobserver, "fifo:", 5) == 0) { + path = jobserver + 5; + read_fd = open(path, O_RDONLY); + write_fd = open(path, O_WRONLY); + return test_fd(read_fd, write_fd, message); + } + + // We don't understand the format + snprintf(message, MAX_MESSAGE_LENGTH, "Unrecognized jobserver format: %s\n", + jobserver); + return 1; +} +#endif + +// Takes 1 argument: an outfile to write results to. +int main(int argc, char** argv) +{ + char message[MAX_MESSAGE_LENGTH + 1]; + char* output_file; + FILE* fp; + char* jobserver; + int result; + + if (argc != 2) { + fprintf(stderr, USAGE, argv[0]); + return 2; + } + + output_file = argv[1]; + fp = fopen(output_file, "w"); + if (fp == NULL) { + fprintf(stderr, "Error opening output file: %s\n", output_file); + return 2; + } + + jobserver = jobserver_auth(message); + if (jobserver == NULL) { + fprintf(stderr, "%s\n", message); + return 1; + } + +#if defined(_WIN32) + result = windows_semaphore(jobserver, message); +#else + result = posix(jobserver, message); +#endif + free(jobserver); + message[MAX_MESSAGE_LENGTH] = '\0'; + + return result; +} diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake index c2f9144..1f89829 100644 --- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -34,6 +34,7 @@ run_cmake_command(AnyCommandGood ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/AnyC run_cmake_command(LastCommandError ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandError.cmake) run_cmake_command(LastCommandTimeout ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandTimeout.cmake) run_cmake_command(LastCommandGood ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/LastCommandGood.cmake) +run_cmake_command(Stdin ${CMAKE_COMMAND} -DPRINT_STDIN_EXE=${PRINT_STDIN_EXE} -P ${RunCMake_SOURCE_DIR}/Stdin.cmake) if(UNIX AND Python_EXECUTABLE) run_cmake_command(AnyCommandAbnormalExit ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/AnyCommandAbnormalExit.cmake) diff --git a/Tests/RunCMake/execute_process/Stdin-stdin.txt b/Tests/RunCMake/execute_process/Stdin-stdin.txt new file mode 100644 index 0000000..cd08755 --- /dev/null +++ b/Tests/RunCMake/execute_process/Stdin-stdin.txt @@ -0,0 +1 @@ +Hello world! diff --git a/Tests/RunCMake/execute_process/Stdin-stdout.txt b/Tests/RunCMake/execute_process/Stdin-stdout.txt new file mode 100644 index 0000000..04bd136 --- /dev/null +++ b/Tests/RunCMake/execute_process/Stdin-stdout.txt @@ -0,0 +1 @@ +^Hello world!$ diff --git a/Tests/RunCMake/execute_process/Stdin.cmake b/Tests/RunCMake/execute_process/Stdin.cmake new file mode 100644 index 0000000..e8a2098 --- /dev/null +++ b/Tests/RunCMake/execute_process/Stdin.cmake @@ -0,0 +1 @@ +execute_process(COMMAND ${PRINT_STDIN_EXE}) diff --git a/Tests/RunCMake/file/REAL_PATH.cmake b/Tests/RunCMake/file/REAL_PATH.cmake index 9c5d4ea..08d400d 100644 --- a/Tests/RunCMake/file/REAL_PATH.cmake +++ b/Tests/RunCMake/file/REAL_PATH.cmake @@ -13,6 +13,43 @@ if (NOT WIN32 OR CYGWIN) if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt") message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"") endif() + + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin/") + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin" "${CMAKE_CURRENT_BINARY_DIR}/dir/bin" SYMBOLIC) + + cmake_policy(SET CMP0152 NEW) + file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/../" real_path) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir/nested") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested\"") + endif() + + file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/../bin" real_path) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin\"") + endif() + + file(REAL_PATH "dir/bin/../bin" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin\"") + endif() + + file(REAL_PATH "../bin" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/" ) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin\"") + endif() + + cmake_policy(SET CMP0152 OLD) + file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/../" real_path) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested\"") + endif() + file(REAL_PATH "../" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/") + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir\"") + endif() + endif() diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt index 185720b..b0bf460 100644 --- a/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt @@ -1,4 +1,4 @@ .*find_library considered the following locations.* -.*\(lib\)library_no_exist\(\\.tbd\|\\.dylib\|\\.so\|\\.a\).* +.*liblibrary_no_exist\(\\.tbd\|\\.dylib\|\\.so\|\\.a\).* .*The item was found at.* .*lib/libcreated.a.* diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr.txt index 046f680..6f25184 100644 --- a/Tests/RunCMake/find_library/FromScriptMode-stderr.txt +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr.txt @@ -1,4 +1,4 @@ .*find_library considered the following locations.* -.*\(lib\)library_no_exist\(\\.so\|\\.a\).* +.*liblibrary_no_exist\(\\.so\|\\.a\).* .*The item was found at.* .*lib/libcreated.a.* diff --git a/Tests/RunCMake/get_property/test_properties-stderr.txt b/Tests/RunCMake/get_property/test_properties-stderr.txt index a447280..9f5a10f 100644 --- a/Tests/RunCMake/get_property/test_properties-stderr.txt +++ b/Tests/RunCMake/get_property/test_properties-stderr.txt @@ -1,6 +1,12 @@ -^get_test_property: --><-- +^get_test_property: -->value<-- +get_property: -->value<-- +get_test_property: --><-- get_property: --><-- get_test_property: -->value<-- get_property: -->value<-- get_test_property: -->NOTFOUND<-- -get_property: --><--$ +get_property: --><-- +get_test_property: -->anotherValue<-- +get_property: -->anotherValue<-- +get_test_property: -->anotherValue<-- +get_property: -->anotherValue<--$ diff --git a/Tests/RunCMake/get_property/test_properties.cmake b/Tests/RunCMake/get_property/test_properties.cmake index 1d0295c..f1cbca4 100644 --- a/Tests/RunCMake/get_property/test_properties.cmake +++ b/Tests/RunCMake/get_property/test_properties.cmake @@ -1,7 +1,11 @@ -function (check_test_property test prop) - get_test_property("${test}" "${prop}" gtp_val) +function (check_test_property test prop dir) + set(dir_args) + if(dir) + set(dir_args DIRECTORY ${dir}) + endif() + get_test_property("${test}" "${prop}" ${dir_args} gtp_val) get_property(gp_val - TEST "${test}" + TEST "${test}" ${dir_args} PROPERTY "${prop}") message("get_test_property: -->${gtp_val}<--") @@ -11,7 +15,10 @@ endfunction () include(CTest) add_test(NAME test COMMAND "${CMAKE_COMMAND}" --help) set_tests_properties(test PROPERTIES empty "" custom value) +add_subdirectory(test_properties) -check_test_property(test empty) -check_test_property(test custom) -check_test_property(test noexist) +check_test_property(test empty "") +check_test_property(test custom "") +check_test_property(test noexist "") +check_test_property(test custom test_properties) +check_test_property(test custom ${CMAKE_BINARY_DIR}/test_properties) diff --git a/Tests/RunCMake/get_property/test_properties/CMakeLists.txt b/Tests/RunCMake/get_property/test_properties/CMakeLists.txt new file mode 100644 index 0000000..ee90344 --- /dev/null +++ b/Tests/RunCMake/get_property/test_properties/CMakeLists.txt @@ -0,0 +1,4 @@ +add_test(NAME test COMMAND "${CMAKE_COMMAND}" --help) +set_tests_properties(test PROPERTIES empty "" custom anotherValue) + +check_test_property(test custom ..) diff --git a/Tests/RunCMake/property_init/Always.cmake b/Tests/RunCMake/property_init/Always.cmake new file mode 100644 index 0000000..db23563 --- /dev/null +++ b/Tests/RunCMake/property_init/Always.cmake @@ -0,0 +1,15 @@ +set(properties + # property expected alias + # Test a property which should never be initialized. + "notset" "<UNSET>" "<SAME>" + + # Build graph properties + "VERIFY_INTERFACE_HEADER_SETS" "TRUE" "<SAME>" + + # Metadata + "FOLDER" "folder" "<SAME>" + ) + +prepare_target_types(always ${all_target_types}) + +run_property_tests(always properties) diff --git a/Tests/RunCMake/property_init/CMakeLists.txt b/Tests/RunCMake/property_init/CMakeLists.txt new file mode 100644 index 0000000..51883af --- /dev/null +++ b/Tests/RunCMake/property_init/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) +project(${RunCMake_TEST} C) + +set(main_sources main.c) +set(library_sources library.c) + +include(util.cmake) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/property_init/CompileSources.cmake b/Tests/RunCMake/property_init/CompileSources.cmake new file mode 100644 index 0000000..e8c5554 --- /dev/null +++ b/Tests/RunCMake/property_init/CompileSources.cmake @@ -0,0 +1,274 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Compilation properties + "COMPILE_WARNING_AS_ERROR" "ON" "<SAME>" + "INTERPROCEDURAL_OPTIMIZATION" "OFF" "<SAME>" + "NO_SYSTEM_FROM_IMPORTED" "ON" "<SAME>" + "VISIBILITY_INLINES_HIDDEN" "ON" "<SAME>" + ## Features + ### PCH + "DISABLE_PRECOMPILE_HEADERS" "ON" "<SAME>" + "PCH_WARN_INVALID" "OFF" "<SAME>" + "PCH_INSTANTIATE_TEMPLATES" "OFF" "<SAME>" + ## Platforms + ### Android + "ANDROID_API" "9" "<SAME>" + "ANDROID_API_MIN" "9" "<SAME>" + "ANDROID_ARCH" "arm64-v8a" "<SAME>" + "ANDROID_ASSETS_DIRECTORIES" "${dir}" "<SAME>" + "ANDROID_JAVA_SOURCE_DIR" "${dir}" "<SAME>" + "ANDROID_STL_TYPE" "system" "<SAME>" + ### macOS + "OSX_ARCHITECTURES" "arm64" "<SAME>" + ### Windows + "MSVC_DEBUG_INFORMATION_FORMAT" "Embedded" "<SAME>" + "MSVC_RUNTIME_LIBRARY" "MultiThreaded" "<SAME>" + "VS_JUST_MY_CODE_DEBUGGING" "ON" "<SAME>" + ### OpenWatcom + "WATCOM_RUNTIME_LIBRARY" "MultiThreaded" "<SAME>" + ## Language + ### CUDA + "CUDA_SEPARABLE_COMPILATION" "ON" "<SAME>" + "CUDA_ARCHITECTURES" "naive" "<SAME>" + ### Fortran + "Fortran_FORMAT" "FREE" "<SAME>" + "Fortran_MODULE_DIRECTORY" "${dir}" "<SAME>" + "Fortran_COMPILER_LAUNCHER" "ccache" "<SAME>" + "Fortran_PREPROCESS" "ON" "<SAME>" + "Fortran_VISIBILITY_PRESET" "hidden" "<SAME>" + ### HIP + "HIP_ARCHITECTURES" "gfx801" "<SAME>" + ### ISPC + "ISPC_COMPILER_LAUNCHER" "ccache" "<SAME>" + "ISPC_HEADER_DIRECTORY" "${dir}" "<SAME>" + "ISPC_HEADER_SUFFIX" "_i.h" "<SAME>" + "ISPC_INSTRUCTION_SETS" "avx2-i32x4" "<SAME>" + ### Swift + "Swift_LANGUAGE_VERSION" "2.3" "<SAME>" + "Swift_MODULE_DIRECTORY" "${dir}" "<SAME>" + ### moc + "AUTOMOC" "OFF" "<SAME>" + "AUTOMOC_COMPILER_PREDEFINES" "OFF" "<SAME>" + "AUTOMOC_MACRO_NAMES" "MOC_CLASS" "<SAME>" + "AUTOMOC_MOC_OPTIONS" "-v" "<SAME>" + "AUTOMOC_PATH_PREFIX" "moc_" "<SAME>" + "AUTOMOC_EXECUTABLE" "automoc" "<SAME>" + ### uic + "AUTOUIC" "OFF" "<SAME>" + "AUTOUIC_OPTIONS" "-v" "<SAME>" + "AUTOUIC_SEARCH_PATHS" "${dir}" "<SAME>" + "AUTOUIC_EXECUTABLE" "autouic" "<SAME>" + ### rcc + "AUTORCC" "OFF" "<SAME>" + "AUTORCC_OPTIONS" "-v" "<SAME>" + "AUTORCC_EXECUTABLE" "autorcc" "<SAME>" + + # Linking properties + "LINK_SEARCH_START_STATIC" "-Bstatic" "<SAME>" + "LINK_SEARCH_END_STATIC" "-Bdynamic" "<SAME>" + ## Dependent library lookup + "MACOSX_RPATH" "@loader_path/" "<SAME>" + ### Build + "BUILD_RPATH" "../lib" "<SAME>" + "BUILD_RPATH_USE_ORIGIN" "ON" "<SAME>" + "SKIP_BUILD_RPATH" "ON" "<SAME>" + "BUILD_WITH_INSTALL_RPATH" "ON" "<SAME>" + "BUILD_WITH_INSTALL_NAME_DIR" "@rpath/" "<SAME>" + ### Install + "INSTALL_NAME_DIR" "@rpath/" "<SAME>" + "INSTALL_REMOVE_ENVIRONMENT_RPATH" "ON" "<SAME>" + "INSTALL_RPATH" "@rpath/" "<SAME>" + "INSTALL_RPATH_USE_LINK_PATH" "ON" "<SAME>" + ## Platforms + ### Android + "ANDROID_JAR_DIRECTORIES" "${dir}" "<SAME>" + "ANDROID_JAR_DEPENDENCIES" "${dir}/foo.jar" "<SAME>" + "ANDROID_NATIVE_LIB_DIRECTORIES" "${dir}" "<SAME>" + "ANDROID_NATIVE_LIB_DEPENDENCIES" "${dir}/native.a" "<SAME>" + "ANDROID_PROGUARD" "ON" "<SAME>" + "ANDROID_PROGUARD_CONFIG_PATH" "proguard.props" "<SAME>" + "ANDROID_SECURE_PROPS_PATH" "secure.props" "<SAME>" + ### iOS + "IOS_INSTALL_COMBINED" "ON" "<SAME>" + ### Windows + "GNUtoMS" "ON" "<SAME>" + "WIN32_EXECUTABLE" "OFF" "<SAME>" + ## Languages + ### C + "C_LINKER_LAUNCHER" "ccache" "<SAME>" + ### C++ + "CXX_LINKER_LAUNCHER" "ccache" "<SAME>" + ### CUDA + "CUDA_RESOLVE_DEVICE_SYMBOLS" "ON" "<SAME>" + "CUDA_RUNTIME_LIBRARY" "Static" "<SAME>" + ### HIP + "HIP_RUNTIME_LIBRARY" "SHARED" "<SAME>" + ### Objective C + "OBJC_LINKER_LAUNCHER" "ccache" "<SAME>" + ### Objective C++ + "OBJCXX_LINKER_LAUNCHER" "ccache" "<SAME>" + + # Static analysis + ## C + "C_CLANG_TIDY" "clang-tidy" "<SAME>" + "C_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "<SAME>" + "C_CPPLINT" "cpplint" "<SAME>" + "C_CPPCHECK" "cppcheck" "<SAME>" + "C_INCLUDE_WHAT_YOU_USE" "iwyu" "<SAME>" + ## C++ + "CXX_CLANG_TIDY" "clang-tidy" "<SAME>" + "CXX_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "<SAME>" + "CXX_CPPLINT" "cpplint" "<SAME>" + "CXX_CPPCHECK" "cppcheck" "<SAME>" + "CXX_INCLUDE_WHAT_YOU_USE" "iwyu" "<SAME>" + ## Objective C + "OBJC_CLANG_TIDY" "clang-tidy" "<SAME>" + "OBJC_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "<SAME>" + ## Objective C++ + "OBJCXX_CLANG_TIDY" "clang-tidy" "<SAME>" + "OBJCXX_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "<SAME>" + ## Linking + "LINK_WHAT_YOU_USE" "lwyu" "<SAME>" + + # Build graph properties + "LINK_DEPENDS_NO_SHARED" "OFF" "<SAME>" + "UNITY_BUILD" "OFF" "<SAME>" + "UNITY_BUILD_UNIQUE_ID" "unity" "<SAME>" + "UNITY_BUILD_BATCH_SIZE" "10" "<SAME>" + "UNITY_BUILD_MODE" "GROUP" "<SAME>" + "OPTIMIZE_DEPENDENCIES" "ON" "<SAME>" + ## Android + "ANDROID_ANT_ADDITIONAL_OPTIONS" "-v" "<SAME>" + "ANDROID_PROCESS_MAX" "2" "<SAME>" + "ANDROID_SKIP_ANT_STEP" "ON" "<SAME>" + ## Autogen + "AUTOGEN_ORIGIN_DEPENDS" "OFF" "<SAME>" + "AUTOGEN_PARALLEL" "ON" "<SAME>" + "AUTOGEN_USE_SYSTEM_INCLUDE" "ON" "<SAME>" + ## moc + "AUTOMOC_DEPEND_FILTERS" "FIRST<SEMI>SECOND" "<SAME>" + ## C++ + "CXX_SCAN_FOR_MODULES" "ON" "<SAME>" + ## Ninja + "JOB_POOL_COMPILE" "compile_pool" "<SAME>" + "JOB_POOL_LINK" "link_pool" "<SAME>" + "JOB_POOL_PRECOMPILE_HEADER" "pch_pool" "<SAME>" + ## Visual Studio + "VS_NO_COMPILE_BATCHING" "ON" "<SAME>" + "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION" "10.0.10240.0" "<SAME>" + + # Output location properties + "ARCHIVE_OUTPUT_DIRECTORY" "${dir}" "<SAME>" + "COMPILE_PDB_OUTPUT_DIRECTORY" "${dir}" "<SAME>" + "LIBRARY_OUTPUT_DIRECTORY" "${dir}" "<SAME>" + "PDB_OUTPUT_DIRECTORY" "${dir}" "<SAME>" + "RUNTIME_OUTPUT_DIRECTORY" "${dir}" "<SAME>" + + # macOS bundle properties + "FRAMEWORK" "OFF" "<SAME>" + "FRAMEWORK_MULTI_CONFIG_POSTFIX" ".mcpostfix" "<SAME>" + "MACOSX_BUNDLE" "OFF" "<SAME>" + + # Usage requirement properties + "LINK_INTERFACE_LIBRARIES" "c" "<SAME>" + + # Metadata + "EXPORT_COMPILE_COMMANDS" "OFF" "<SAME>" + ) + +if (CMAKE_HOST_APPLE) # compile-guarded in CMake + if (CMAKE_GENERATOR STREQUAL "Xcode") + list(APPEND properties + # property expected alias + # Xcode properties + "XCODE_SCHEME_ADDRESS_SANITIZER" "ON" "<SAME>" + "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN" "ON" "<SAME>" + "XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING" "ON" "<SAME>" + "XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE" "ON" "<SAME>" + "XCODE_SCHEME_THREAD_SANITIZER" "ON" "<SAME>" + "XCODE_SCHEME_THREAD_SANITIZER_STOP" "ON" "<SAME>" + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER" "ON" "<SAME>" + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "ON" "<SAME>" + "XCODE_SCHEME_LAUNCH_CONFIGURATION" "ON" "<SAME>" + "XCODE_SCHEME_ENABLE_GPU_API_VALIDATION" "ON" "<SAME>" + "XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION" "ON" "<SAME>" + "XCODE_SCHEME_WORKING_DIRECTORY" "ON" "<SAME>" + "XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER" "ON" "<SAME>" + "XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP" "ON" "<SAME>" + "XCODE_SCHEME_MALLOC_SCRIBBLE" "ON" "<SAME>" + "XCODE_SCHEME_MALLOC_GUARD_EDGES" "ON" "<SAME>" + "XCODE_SCHEME_GUARD_MALLOC" "ON" "<SAME>" + "XCODE_SCHEME_LAUNCH_MODE" "ON" "<SAME>" + "XCODE_SCHEME_ZOMBIE_OBJECTS" "ON" "<SAME>" + "XCODE_SCHEME_MALLOC_STACK" "ON" "<SAME>" + "XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE" "ON" "<SAME>" + "XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS" "ON" "<SAME>" + "XCODE_SCHEME_ENVIRONMENT" "ON" "<SAME>" + "XCODE_LINK_BUILD_PHASE_MODE" "BUILT_ONLY" "<SAME>" + ) + endif () +endif () + +macro (add_language_properties lang std) + list(APPEND properties + # property expected alias + "${lang}_COMPILER_LAUNCHER" "ccache" "<SAME>" + "${lang}_STANDARD" "${std}" "<SAME>" + "${lang}_STANDARD_REQUIRED" "TRUE" "<SAME>" + "${lang}_EXTENSIONS" "FALSE" "<SAME>" + "${lang}_VISIBILITY_PRESET" "hidden" "<SAME>" + ) +endmacro () + +# Mock up knowing the standard flag. This doesn't actually build, so nothing +# should care at this point. +set(CMAKE_Cc_std_11_STANDARD_COMPILE_OPTION "-std=c11") + +add_language_properties(C c_std_11) +add_language_properties(CXX cxx_std_11) +add_language_properties(CUDA cuda_std_11) +add_language_properties(HIP hip_std_11) +add_language_properties(OBJC c_std_99) +add_language_properties(OBJCXX cxx_std_11) + +# Set up pools for properties set above. +if (CMAKE_GENERATOR MATCHES "Ninja") + set_property(GLOBAL APPEND + PROPERTY + JOB_POOLS + compile_pool=1 + link_pool=1 + pch_pool=1) +endif () + +prepare_target_types(can_compile_sources + EXECUTABLE SHARED STATIC MODULE OBJECT) + +run_property_tests(can_compile_sources properties) + +set(properties_with_defaults + # property expected alias + "PCH_WARN_INVALID" "ON" "<SAME>" + "PCH_INSTANTIATE_TEMPLATES" "ON" "<SAME>" + "ISPC_HEADER_SUFFIX" "_ispc.h" "<SAME>" + "SKIP_BUILD_RPATH" "OFF" "<SAME>" + "BUILD_WITH_INSTALL_RPATH" "OFF" "<SAME>" + "INSTALL_RPATH" "" "<SAME>" + "INSTALL_RPATH_USE_LINK_PATH" "OFF" "<SAME>" + "UNITY_BUILD_BATCH_SIZE" "8" "<SAME>" + "UNITY_BUILD_MODE" "BATCH" "<SAME>" + ) + +if (CMAKE_HOST_APPLE) + if (CMAKE_GENERATOR STREQUAL "Xcode") + list(APPEND properties_with_defaults + # property expected alias + "XCODE_LINK_BUILD_PHASE_MODE" "NONE" "<SAME>" + ) + endif () +endif () + +set(with_defaults 1) +run_property_tests(can_compile_sources properties_with_defaults) diff --git a/Tests/RunCMake/property_init/Executable.cmake b/Tests/RunCMake/property_init/Executable.cmake new file mode 100644 index 0000000..ede0e4b --- /dev/null +++ b/Tests/RunCMake/property_init/Executable.cmake @@ -0,0 +1,25 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Compilation properties + ## Platforms + ### Windows + "VS_DEBUGGER_COMMAND" "vsdbg" "<SAME>" + "VS_DEBUGGER_COMMAND_ARGUMENTS" "/?" "<SAME>" + "VS_DEBUGGER_ENVIRONMENT" "env=val" "<SAME>" + "VS_DEBUGGER_WORKING_DIRECTORY" "${dir}" "<SAME>" + + # Linking properties + ## Platforms + ### Android + "ANDROID_GUI" "OFF" "<SAME>" + + # Metadata + "CROSSCOMPILING_EMULATOR" "emu" "<SAME>" + ) + +prepare_target_types(executable + EXECUTABLE + IMPORTED_EXECUTABLE) +run_property_tests(executable properties) diff --git a/Tests/RunCMake/property_init/ImportedTargets.cmake b/Tests/RunCMake/property_init/ImportedTargets.cmake new file mode 100644 index 0000000..0b51998 --- /dev/null +++ b/Tests/RunCMake/property_init/ImportedTargets.cmake @@ -0,0 +1,9 @@ +set(properties + # property expected alias + "SYSTEM" "ON" "<SAME>" + ) + +prepare_target_types(imported + IMPORTED_EXECUTABLE IMPORTED_INTERFACE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +set(with_defaults 1) +run_property_tests(imported properties) diff --git a/Tests/RunCMake/property_init/LibraryArtifact.cmake b/Tests/RunCMake/property_init/LibraryArtifact.cmake new file mode 100644 index 0000000..942b433 --- /dev/null +++ b/Tests/RunCMake/property_init/LibraryArtifact.cmake @@ -0,0 +1,10 @@ +per_config(properties + # property expected alias + # Linking properties + "_POSTFIX" "test" "<UNSET>" + ) + +prepare_target_types(library_with_artifact + MODULE SHARED STATIC + IMPORTED_MODULE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(library_with_artifact properties) diff --git a/Tests/RunCMake/property_init/Linkable.cmake b/Tests/RunCMake/property_init/Linkable.cmake new file mode 100644 index 0000000..e5d75d1 --- /dev/null +++ b/Tests/RunCMake/property_init/Linkable.cmake @@ -0,0 +1,12 @@ +per_config(properties + # property expected alias + # Linking properties + ## Platforms + ### macOS + "FRAMEWORK_MULTI_CONFIG_POSTFIX_" ".fw" "<UNSET>" + ) + +prepare_target_types(linkable + EXECUTABLE SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(linkable properties) diff --git a/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake b/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake new file mode 100644 index 0000000..cf3b726 --- /dev/null +++ b/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake @@ -0,0 +1,9 @@ +set(properties + # property expected alias + # Linking properties + "LINK_LIBRARIES_ONLY_TARGETS" "OFF" "<SAME>" + ) + +prepare_target_types(normal_non_imported + EXECUTABLE SHARED STATIC MODULE OBJECT INTERFACE) +run_property_tests(normal_non_imported properties) diff --git a/Tests/RunCMake/property_init/NonImportedTarget.cmake b/Tests/RunCMake/property_init/NonImportedTarget.cmake new file mode 100644 index 0000000..7e2e22c --- /dev/null +++ b/Tests/RunCMake/property_init/NonImportedTarget.cmake @@ -0,0 +1,11 @@ +set(properties + # property expected alias + # Compilation properties + ## Language + ### CSharp + "DOTNET_SDK" "Microsoft.NET.Sdk" "<SAME>" + ) + +prepare_target_types(non_imported + EXECUTABLE SHARED STATIC MODULE OBJECT INTERFACE CUSTOM) +run_property_tests(non_imported properties) diff --git a/Tests/RunCMake/property_init/NormalTarget.cmake b/Tests/RunCMake/property_init/NormalTarget.cmake new file mode 100644 index 0000000..99507cf --- /dev/null +++ b/Tests/RunCMake/property_init/NormalTarget.cmake @@ -0,0 +1,10 @@ +per_config(properties + # property expected alias + # Usage requirement properties + "MAP_IMPORTED_CONFIG_" "Release" "<UNSET>" + ) + +prepare_target_types(normal + EXECUTABLE INTERFACE MODULE OBJECT SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_INTERFACE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(normal properties) diff --git a/Tests/RunCMake/property_init/PICTargets.cmake b/Tests/RunCMake/property_init/PICTargets.cmake new file mode 100644 index 0000000..6c99505 --- /dev/null +++ b/Tests/RunCMake/property_init/PICTargets.cmake @@ -0,0 +1,21 @@ +set(properties + # property expected alias + # Compilation properties + "POSITION_INDEPENDENT_CODE" "True" "<SAME>" + ) + +prepare_target_types(pic_targets + EXECUTABLE MODULE OBJECT SHARED STATIC + IMPORTED_MODULE IMPORTED_SHARED) +run_property_tests(pic_targets properties) + +set(APPEND properties_with_defaults + # property expected alias + "POSITION_INDEPENDENT_CODE" "True" "<SAME>" + ) + +prepare_target_types(pic_default_targets + MODULE SHARED + IMPORTED_MODULE IMPORTED_SHARED) +set(with_defaults 1) +run_property_tests(pic_default_targets properties_with_defaults) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake new file mode 100644 index 0000000..310da72 --- /dev/null +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -0,0 +1,16 @@ +include(RunCMake) + +run_cmake(Always) +run_cmake(CompileSources) +run_cmake(Executable) +run_cmake(ImportedTargets) +run_cmake(LibraryArtifact) +run_cmake(Linkable) +run_cmake(NonImportedNormalTarget) +run_cmake(NonImportedTarget) +run_cmake(NormalTarget) +run_cmake(PICTargets) +run_cmake(SharedLibrary) +run_cmake(TargetsWithArtifact) +run_cmake(TargetsWithCommands) +run_cmake(TargetsWithExports) diff --git a/Tests/RunCMake/property_init/SharedLibrary.cmake b/Tests/RunCMake/property_init/SharedLibrary.cmake new file mode 100644 index 0000000..49715a4 --- /dev/null +++ b/Tests/RunCMake/property_init/SharedLibrary.cmake @@ -0,0 +1,12 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Linking properties + "DLL_NAME_WITH_SOVERSION" "OFF" "<SAME>" + ) + +prepare_target_types(shared_library + SHARED + IMPORTED_SHARED) +run_property_tests(shared_library properties) diff --git a/Tests/RunCMake/property_init/TargetsWithArtifact.cmake b/Tests/RunCMake/property_init/TargetsWithArtifact.cmake new file mode 100644 index 0000000..0c19ea3 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithArtifact.cmake @@ -0,0 +1,19 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +per_config(properties + # property expected alias + # Compilation properties + "INTERPROCEDURAL_OPTIMIZATION_" "OFF" "<UNSET>" + + # Output location properties + "ARCHIVE_OUTPUT_DIRECTORY_" "${dir}" "<UNSET>" + "COMPILE_PDB_OUTPUT_DIRECTORY_" "${dir}" "<UNSET>" + "LIBRARY_OUTPUT_DIRECTORY_" "${dir}" "<UNSET>" + "PDB_OUTPUT_DIRECTORY_" "${dir}" "<UNSET>" + "RUNTIME_OUTPUT_DIRECTORY_" "${dir}" "<UNSET>" + ) + +prepare_target_types(with_artifact + EXECUTABLE MODULE SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_MODULE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(with_artifact properties) diff --git a/Tests/RunCMake/property_init/TargetsWithCommands.cmake b/Tests/RunCMake/property_init/TargetsWithCommands.cmake new file mode 100644 index 0000000..4db0ca3 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithCommands.cmake @@ -0,0 +1,13 @@ +set(properties + # property expected alias + # Compilation properties + ## Language + ### CSharp + "DOTNET_TARGET_FRAMEWORK" "netcoreapp2.1" "<SAME>" + "DOTNET_TARGET_FRAMEWORK_VERSION" "v4.5" "<SAME>" + ) + +prepare_target_types(with_commands + EXECUTABLE MODULE OBJECT SHARED STATIC CUSTOM + IMPORTED_EXECUTABLE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(with_commands properties) diff --git a/Tests/RunCMake/property_init/TargetsWithExports.cmake b/Tests/RunCMake/property_init/TargetsWithExports.cmake new file mode 100644 index 0000000..9b2e213 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithExports.cmake @@ -0,0 +1,51 @@ +set(properties + # property expected alias + # Linking properties + ## Platforms + ### AIX + "AIX_EXPORT_ALL_SYMBOLS" "OFF" "<SAME>" + ### Windows + "WINDOWS_EXPORT_ALL_SYMBOLS" "OFF" "<SAME>" + ) + +prepare_target_types(symbol_export_target + EXECUTABLE SHARED + IMPORTED_EXECUTABLE IMPORTED_SHARED) +run_property_tests(symbol_export_target properties) + +# `ENABLE_EXPORTS` has a more complicated initialization. +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "<SAME>" + ) + +prepare_target_types(executable + EXECUTABLE + IMPORTED_EXECUTABLE) +set(iteration "-ENABLE_EXPORTS") +run_property_tests(executable_target properties) + +set(with_defaults 1) + +set(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS OFF) +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "<SAME>" + ) + +set(iteration "-SHARED_LIBRARY_ENABLE_EXPORTS") +run_property_tests(shared_library_target properties) +unset(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS) + +set(CMAKE_EXECUTABLE_ENABLE_EXPORTS OFF) +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "<SAME>" + ) + +set(iteration "-EXECUTABLE_ENABLE_EXPORTS") +run_property_tests(executable_target properties) +unset(CMAKE_EXECUTABLE_ENABLE_EXPORTS) diff --git a/Tests/RunCMake/property_init/library.c b/Tests/RunCMake/property_init/library.c new file mode 100644 index 0000000..ad6a649 --- /dev/null +++ b/Tests/RunCMake/property_init/library.c @@ -0,0 +1,4 @@ +int foo(int arg) +{ + return arg; +} diff --git a/Tests/RunCMake/property_init/main.c b/Tests/RunCMake/property_init/main.c new file mode 100644 index 0000000..14917b7 --- /dev/null +++ b/Tests/RunCMake/property_init/main.c @@ -0,0 +1,4 @@ +int main(int argc, char* argv[]) +{ + return argc - 1; +} diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake new file mode 100644 index 0000000..7edc6f9 --- /dev/null +++ b/Tests/RunCMake/property_init/util.cmake @@ -0,0 +1,191 @@ +set(all_target_types + "EXECUTABLE" + + "IMPORTED_EXECUTABLE" + + "INTERFACE" + "MODULE" + "OBJECT" + "SHARED" + "STATIC" + + "IMPORTED_INTERFACE" + "IMPORTED_MODULE" + "IMPORTED_OBJECT" + "IMPORTED_SHARED" + "IMPORTED_STATIC" + + "CUSTOM") + +function (prepare_target_types name) + set("${name}" "${ARGN}" PARENT_SCOPE) + list(REMOVE_ITEM all_target_types ${ARGN}) + set("not_${name}" "${all_target_types}" PARENT_SCOPE) +endfunction () + +function (per_config variable) + prepare_properties("${property_table}" properties expected_values expected_alias) + + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if (is_multi_config) + set(configs "${CMAKE_CONFIGURATION_TYPES}") + else () + if (NOT CMAKE_BUILD_TYPE STREQUAL "") + set(configs "${CMAKE_BUILD_TYPE}") + endif () + endif () + + foreach (property expected alias IN ZIP_LISTS expected_properties expected_values expected_alias) + if (property MATCHES "^_") + set(prepend 1) + elseif (property MATCHES "_$") + set(prepend 0) + else () + message(SEND_ERROR + "Per-config properties must have a `_` at one end of their name: '${property}'") + endif () + foreach (config IN LISTS configs) + if (prepend) + list(APPEND "${variable}" + "${config}_${property}" "${value}/${config}" "${alias}") + else () + list(APPEND "${variable}" + "${property}_${config}" "${value}/${config}" "${alias}") + endif () + endforeach () + endforeach () + + set("${variable}" "${${variable}}" PARENT_SCOPE) +endfunction () + +function (make_target name type) + if (type STREQUAL "EXECUTABLE") + add_executable("${name}") + target_sources("${name}" PRIVATE ${main_sources}) + elseif (type STREQUAL "IMPORTED_EXECUTABLE") + add_executable("${name}" IMPORTED) + set_property(TARGET "${name}" PROPERTY IMPORTED_LOCATION "${CMAKE_COMMAND}") + elseif (type STREQUAL "CUSTOM") + add_custom_target("${name}" COMMAND "${CMAKE_EXECUTABLE}" -E echo "${name}") + elseif (type MATCHES "IMPORTED_") + string(REPLACE "IMPORTED_" "" type "${type}") + add_library("${name}" IMPORTED ${type}) + if (NOT type STREQUAL "INTERFACE") + set_property(TARGET "${name}" PROPERTY IMPORTED_LOCATION "${default_library_location}") + endif () + else () + add_library("${name}" ${type}) + target_sources("${name}" PRIVATE ${library_sources}) + endif () + + if (type MATCHES "EXECUTABLE") + add_executable("alias::${name}" ALIAS "${name}") + elseif (NOT type STREQUAL "CUSTOM") + add_library("alias::${name}" ALIAS "${name}") + endif () +endfunction () + +function (check_property target property expected) + if (NOT TARGET "${target}") + message(SEND_ERROR + "No such target '${target}'") + return () + endif () + + get_property(is_set TARGET "${target}" PROPERTY "${property}" SET) + if (is_set) + get_property(actual TARGET "${target}" PROPERTY "${property}") + endif () + if (expected STREQUAL "<UNSET>") + if (is_set) + message(SEND_ERROR + "Target '${target}' should not have '${property}' set at all, but is '${actual}'") + endif () + elseif (is_set AND NOT expected STREQUAL actual) + message(SEND_ERROR + "Target '${target}' should have '${property}' set to '${expected}', but is '${actual}'") + elseif (NOT is_set) + message(SEND_ERROR + "Target '${target}' should have '${property}' set to '${expected}', but is not set at all") + endif () +endfunction () + +function (prepare_properties table output_properties output_expected output_alias) + set(_properties) + set(_expected) + set(_alias) + + set(variable "_properties") + foreach (item IN LISTS "${table}") + list(APPEND "${variable}" "${item}") + if (variable STREQUAL "_properties") + set(variable "_expected") + elseif (variable STREQUAL "_expected") + set(variable "_alias") + elseif (variable STREQUAL "_alias") + set(variable "_properties") + else () + message(FATAL_ERROR + "Failed to track property table parsing") + endif () + endforeach () + if (NOT variable STREQUAL "_properties") + message(FATAL_ERROR + "Table does not have a multiple of 3 items") + endif () + + set("${output_properties}" "${_properties}" PARENT_SCOPE) + set("${output_expected}" "${_expected}" PARENT_SCOPE) + set("${output_alias}" "${_alias}" PARENT_SCOPE) +endfunction () + +# Contextual variables: +# iteration: make unique target names +# with_defaults: if set, do not set variables, but instead test internal +# default calculations +function (run_property_tests applied_types property_table) + prepare_properties("${property_table}" expected_properties expected_values expected_alias) + + if (NOT with_defaults) + foreach (property expected IN ZIP_LISTS expected_properties expected_values) + string(REPLACE "<SEMI>" ";" expected "${expected}") + set("CMAKE_${property}" "${expected}") + endforeach () + endif () + + foreach (target_type IN LISTS "${applied_types}") + set(target_name "${RunCMake_TEST}${iteration}-${target_type}") + if (with_defaults) + string(APPEND target_name "-defaults") + endif () + make_target("${target_name}" "${target_type}") + foreach (property expected alias IN ZIP_LISTS expected_properties expected_values expected_alias) + string(REPLACE "<SEMI>" ";" expected "${expected}") + check_property("${target_name}" "${property}" "${expected}") + if (NOT target_type STREQUAL "CUSTOM") + if (alias STREQUAL "<SAME>") + check_property("alias::${target_name}" "${property}" "${expected}") + elseif (alias STREQUAL "<UNSET>") + check_property("alias::${target_name}" "${property}" "<UNSET>") + else () + message(FATAL_ERROR + "Invalid `alias` entry for property '${property}': '${alias}'") + endif () + endif () + endforeach () + endforeach () + + foreach (target_type IN LISTS "not_${applied_types}") + set(target_name "${RunCMake_TEST}${iteration}-${target_type}-unset") + if (with_defaults) + string(APPEND target_name "-defaults") + endif () + make_target("${target_name}" "${target_type}") + foreach (property IN LISTS expected_properties) + check_property("${target_name}" "${property}" "<UNSET>") + if (NOT target_type STREQUAL "CUSTOM") + check_property("alias::${target_name}" "${property}" "<UNSET>") + endif () + endforeach () + endforeach () +endfunction () diff --git a/Tests/RunCMake/set/CacheErrors-result.txt b/Tests/RunCMake/set/CacheErrors-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/set/CacheErrors-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/set/CacheErrors-stderr.txt b/Tests/RunCMake/set/CacheErrors-stderr.txt new file mode 100644 index 0000000..9983160 --- /dev/null +++ b/Tests/RunCMake/set/CacheErrors-stderr.txt @@ -0,0 +1,19 @@ +^CMake Error at CacheErrors\.cmake:1 \(set\): + set given invalid arguments for CACHE mode: missing type and docstring +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CacheErrors\.cmake:2 \(set\): + set given invalid arguments for CACHE mode: missing type or docstring +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CacheErrors\.cmake:3 \(set\): + set given invalid arguments for CACHE mode: missing type or docstring +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CacheErrors\.cmake:4 \(set\): + set given invalid arguments: FORCE specified without CACHE +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/set/CacheErrors.cmake b/Tests/RunCMake/set/CacheErrors.cmake new file mode 100644 index 0000000..d177474 --- /dev/null +++ b/Tests/RunCMake/set/CacheErrors.cmake @@ -0,0 +1,4 @@ +set (var val CACHE) +set (var val CACHE STRING) +set (var val CACHE "") +set (var val CACH3 STRING "" FORCE) diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake index b3bd0a4..c785450 100644 --- a/Tests/RunCMake/set/RunCMakeTest.cmake +++ b/Tests/RunCMake/set/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(CacheErrors) run_cmake(ParentScope) run_cmake(ParentPulling) run_cmake(ParentPullingRecursive) diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index 692c6b9..1a5498d 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -10,6 +10,12 @@ run_cmake(LINK_DIRECTORIES) run_cmake(LINK_LIBRARIES) run_cmake(SOURCES) run_cmake(SOURCE_FILE) +run_cmake(TEST-invalid) run_cmake(TYPE) run_cmake(USER_PROP) run_cmake(USER_PROP_INHERITED) + +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/TEST-build") +run_cmake(TEST) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(TEST-test ${CMAKE_CTEST_COMMAND} -C Debug) diff --git a/Tests/RunCMake/set_property/TEST-invalid-result.txt b/Tests/RunCMake/set_property/TEST-invalid-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/set_property/TEST-invalid-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/set_property/TEST-invalid-stderr.txt b/Tests/RunCMake/set_property/TEST-invalid-stderr.txt new file mode 100644 index 0000000..c0a40d6 --- /dev/null +++ b/Tests/RunCMake/set_property/TEST-invalid-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at TEST-invalid\.cmake:[0-9]+ \(set_property\): + set_property called with incorrect number of arguments no value provided to + the DIRECTORY option +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at TEST-invalid\.cmake:[0-9]+ \(set_property\): + set_property given non-existent DIRECTORY nonexistent +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/set_property/TEST-invalid.cmake b/Tests/RunCMake/set_property/TEST-invalid.cmake new file mode 100644 index 0000000..6828c96 --- /dev/null +++ b/Tests/RunCMake/set_property/TEST-invalid.cmake @@ -0,0 +1,4 @@ +enable_testing() + +set_property(TEST t DIRECTORY PROPERTY PASS_REGULAR_EXPRESSION "Invalid") +set_property(TEST t DIRECTORY nonexistent PROPERTY PASS_REGULAR_EXPRESSION "Invalid") diff --git a/Tests/RunCMake/set_property/TEST-subdir1/CMakeLists.txt b/Tests/RunCMake/set_property/TEST-subdir1/CMakeLists.txt new file mode 100644 index 0000000..b1fad66 --- /dev/null +++ b/Tests/RunCMake/set_property/TEST-subdir1/CMakeLists.txt @@ -0,0 +1,3 @@ +add_test(NAME t COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") +add_test(NAME t2 COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") +add_test(NAME t3 COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") diff --git a/Tests/RunCMake/set_property/TEST-subdir2/CMakeLists.txt b/Tests/RunCMake/set_property/TEST-subdir2/CMakeLists.txt new file mode 100644 index 0000000..8621b00 --- /dev/null +++ b/Tests/RunCMake/set_property/TEST-subdir2/CMakeLists.txt @@ -0,0 +1 @@ +set_property(TEST t3 DIRECTORY ../TEST-subdir1 PROPERTY PASS_REGULAR_EXPRESSION "Subdirectory") diff --git a/Tests/RunCMake/set_property/TEST.cmake b/Tests/RunCMake/set_property/TEST.cmake new file mode 100644 index 0000000..7ef5aa3 --- /dev/null +++ b/Tests/RunCMake/set_property/TEST.cmake @@ -0,0 +1,9 @@ +enable_testing() + +add_test(NAME t COMMAND ${CMAKE_COMMAND} -E echo "Top directory") +add_subdirectory(TEST-subdir1) +add_subdirectory(TEST-subdir2) + +set_property(TEST t PROPERTY PASS_REGULAR_EXPRESSION "Top directory") +set_property(TEST t DIRECTORY TEST-subdir1 PROPERTY PASS_REGULAR_EXPRESSION "Subdirectory") +set_property(TEST t2 DIRECTORY "${CMAKE_BINARY_DIR}/TEST-subdir1" PROPERTY PASS_REGULAR_EXPRESSION "Subdirectory") diff --git a/Tests/RunCMake/set_tests_properties/CMakeLists.txt b/Tests/RunCMake/set_tests_properties/CMakeLists.txt new file mode 100644 index 0000000..922aad6 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.27) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-result.txt b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-stderr.txt b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-stderr.txt new file mode 100644 index 0000000..e219399 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at DIRECTORY-invalid\.cmake:[0-9]+ \(set_tests_properties\): + Error after keyword "DIRECTORY": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at DIRECTORY-invalid\.cmake:[0-9]+ \(set_tests_properties\): + set_tests_properties given non-existent DIRECTORY nonexistent +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid.cmake b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid.cmake new file mode 100644 index 0000000..4d87df1 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid.cmake @@ -0,0 +1,4 @@ +enable_testing() + +set_tests_properties(t DIRECTORY PROPERTIES PASS_REGULAR_EXPRESSION "Top directory") +set_tests_properties(t DIRECTORY nonexistent PROPERTIES PASS_REGULAR_EXPRESSION "Top directory") diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir1/CMakeLists.txt b/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir1/CMakeLists.txt new file mode 100644 index 0000000..b1fad66 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir1/CMakeLists.txt @@ -0,0 +1,3 @@ +add_test(NAME t COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") +add_test(NAME t2 COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") +add_test(NAME t3 COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir2/CMakeLists.txt b/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir2/CMakeLists.txt new file mode 100644 index 0000000..8859597 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir2/CMakeLists.txt @@ -0,0 +1 @@ +set_tests_properties(t3 DIRECTORY ../DIRECTORY-subdir1 PROPERTIES PASS_REGULAR_EXPRESSION "Subdirectory") diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY.cmake b/Tests/RunCMake/set_tests_properties/DIRECTORY.cmake new file mode 100644 index 0000000..87d13e3 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY.cmake @@ -0,0 +1,9 @@ +enable_testing() + +add_test(NAME t COMMAND ${CMAKE_COMMAND} -E echo "Top directory") +add_subdirectory(DIRECTORY-subdir1) +add_subdirectory(DIRECTORY-subdir2) + +set_tests_properties(t PROPERTIES PASS_REGULAR_EXPRESSION "Top directory") +set_tests_properties(t DIRECTORY DIRECTORY-subdir1 PROPERTIES PASS_REGULAR_EXPRESSION "Subdirectory") +set_tests_properties(t2 DIRECTORY "${CMAKE_BINARY_DIR}/DIRECTORY-subdir1" PROPERTIES PASS_REGULAR_EXPRESSION "Subdirectory") diff --git a/Tests/RunCMake/set_tests_properties/RunCMakeTest.cmake b/Tests/RunCMake/set_tests_properties/RunCMakeTest.cmake new file mode 100644 index 0000000..b49158f --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(DIRECTORY-invalid) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DIRECTORY-build) +run_cmake(DIRECTORY) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(DIRECTORY-test ${CMAKE_CTEST_COMMAND} -C Debug) diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake index 4a0f068..65c708c 100644 --- a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake +++ b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake @@ -14,8 +14,14 @@ set_property(TARGET import-local PROPERTY IMPORTED_LOCATION "${binary_dir}/${CMA set_property(TARGET import-local PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_IMPORT_LIBRARY_SUFFIX}") add_library(alias::local ALIAS import-local) +if(NOT DEFINED CMAKE_IMPORT_LIBRARY_SUFFIX) + add_library(import-local-stub SHARED IMPORTED) + set_property(TARGET import-local-stub PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_SHARED_LIBRARY_SUFFIX}") + add_library(alias::local-stub ALIAS import-local-stub) +endif() + add_library (lib-local SHARED lib.c) -target_link_libraries (lib-local PRIVATE alias::local) +target_link_libraries (lib-local PRIVATE alias::local $<TARGET_NAME_IF_EXISTS:alias::local-stub>) add_executable (main-local main.c) target_link_libraries (main-local PRIVATE alias::local) diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake index 9b6581c..8e4745a 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake @@ -126,7 +126,7 @@ if ((CMAKE_SYSTEM_NAME STREQUAL "Windows" AND ((DEFINED MSVC_VERSION AND MSVC_VERSION GREATER "1900") OR (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT CMAKE_C_SIMULATE_ID STREQUAL "MSVC"))) OR (CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND (NOT CMAKE_C_COMPILER_ID STREQUAL "SunPro" OR CMAKE_C_COMPILER_VERSION GREATER "5.9")) - OR CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS|Linux|BSD|MSYS|CYGWIN") + OR CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|visionOS|watchOS|Linux|BSD|MSYS|CYGWIN") run_cmake(feature-WHOLE_ARCHIVE) run_cmake_target(feature-WHOLE_ARCHIVE link-exe main) endif() diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetStub.cmake b/Tests/RunCMake/target_link_libraries/ImportedTargetStub.cmake new file mode 100644 index 0000000..04f9cfb --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetStub.cmake @@ -0,0 +1,2 @@ +add_library(SharedStubImportedGlobal SHARED IMPORTED GLOBAL) +set_target_properties(SharedStubImportedGlobal PROPERTIES IMPORTED_IMPLIB z) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 7c5d77d..0e3877a 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -23,6 +23,7 @@ run_cmake(CMP0079-link-NEW-bogus) run_cmake(CMP0108-OLD-self-link) run_cmake(CMP0108-NEW-self-link) run_cmake(ImportedTarget) +run_cmake(ImportedTargetStub) run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-check.cmake new file mode 100644 index 0000000..0f897fe --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_\\$dollar") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_$dollar'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake index bb04841..879151b 100644 --- a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake @@ -53,3 +53,7 @@ target_link_options(LinkOptions_mod PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RE # executable with generator expression add_executable(LinkOptions_exe LinkOptionsExe.c) target_link_options(LinkOptions_exe PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>) + +# executable with dollar character +add_executable(LinkOptions_dollar_exe LinkOptionsExe.c) +target_link_options(LinkOptions_dollar_exe PRIVATE "${pre}BADFLAG_$dollar${obj}") diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake index 1a29ecf..ff0c5a8 100644 --- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -30,7 +30,7 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release) run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release) run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release) - + run_cmake_target(LINK_OPTIONS dollar-option LinkOptions_dollar_exe --config Release) run_cmake(genex_LINK_LANGUAGE) diff --git a/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirExport.cmake b/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirExport.cmake new file mode 100644 index 0000000..f049d91 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirExport.cmake @@ -0,0 +1,16 @@ +enable_language(C) + +# According to https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#module:GNUInstallDirs +# relative CMAKE_INSTALL_<dir> are encouraged, but absolute path's are also allowed. +# Construct an absolute CMAKE_INSTALL_INCLUDEDIR. +set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include") + +add_library(lib1) +target_sources(lib1 + PRIVATE lib1.c + PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +# Expect install(TARGETS) to respect absolute CMAKE_INSTALL_INCLUDEDIR +# when installing the HEADERS. +# Must not prepend the CMAKE_INSTALL_PREFIX in the <pkg>-config.cmake. +install(TARGETS lib1 EXPORT lib1-config FILE_SET HEADERS) +install(EXPORT lib1-config NAMESPACE lib1:: DESTINATION share/lib1) diff --git a/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirImport.cmake b/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirImport.cmake new file mode 100644 index 0000000..123d6ae --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirImport.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +get_filename_component(CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}" DIRECTORY) +string(APPEND CMAKE_PREFIX_PATH "/FileSetAbsoluteInstallIncludeDirExport-build/install") + +find_package(lib1 REQUIRED) + +add_executable(exe main.cpp) +target_link_libraries(exe PRIVATE lib1::lib1) diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake index 44f1626..9a8429d 100644 --- a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET UNKNOWN) diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake index adf1185..f63308c 100644 --- a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "ac01f462-0f5f-432a-86aa-acef252918a6") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index 90915cd..8505f71 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -99,3 +99,4 @@ function(run_export_import name) endfunction() run_export_import(FileSet) +run_export_import(FileSetAbsoluteInstallIncludeDir) |