diff options
Diffstat (limited to 'Tests')
34 files changed, 530 insertions, 69 deletions
diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt index d88eb11..4999612 100644 --- a/Tests/ExportImport/CMakeLists.txt +++ b/Tests/ExportImport/CMakeLists.txt @@ -16,14 +16,12 @@ set_property( ) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") +if(_isMultiConfig OR CMAKE_BUILD_TYPE) + set(NESTED_CONFIG_TYPE -C "$<CONFIG>") + set(NESTED_CONFIG_INSTALL_TYPE --config "$<CONFIG>") else() - if(CMAKE_BUILD_TYPE) - set(NESTED_CONFIG_TYPE -C "${CMAKE_BUILD_TYPE}") - else() - set(NESTED_CONFIG_TYPE) - endif() + set(NESTED_CONFIG_TYPE) + set(NESTED_CONFIG_INSTALL_TYPE) endif() if(MINGW OR MSYS) @@ -79,5 +77,21 @@ set_property( PROPERTY SYMBOLIC 1 ) +# Install the imported targets. +add_custom_command( + OUTPUT ${ExportImport_BINARY_DIR}/ImportInstall + COMMAND ${CMAKE_COMMAND} -E rm -rf ${ExportImport_BINARY_DIR}/Import/install + COMMAND ${CMAKE_COMMAND} + --install ${ExportImport_BINARY_DIR}/Import + --prefix ${ExportImport_BINARY_DIR}/Import/install + ${NESTED_CONFIG_INSTALL_TYPE} + ) +add_custom_target(ImportInstallTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ImportInstall) +add_dependencies(ImportInstallTarget ImportTarget) +set_property( + SOURCE ${ExportImport_BINARY_DIR}/ImportInstall + PROPERTY SYMBOLIC 1 + ) + add_executable(ExportImport main.c) add_dependencies(ExportImport ImportTarget) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 6d9b4ab..fa0016b 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -395,6 +395,10 @@ target_include_directories(systemlib $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> ) +add_library(testMod1 MODULE empty.cpp) +add_library(testMod2 MODULE empty.cpp) +set_property(TARGET testMod2 PROPERTY BUNDLE 1) + install(TARGETS testLibRequired EXPORT RequiredExp DESTINATION lib INCLUDES DESTINATION @@ -523,6 +527,7 @@ install( testLibDeprecation testLibCycleA testLibCycleB testLibNoSONAME + testMod1 testMod2 cmp0022NEW cmp0022OLD TopDirLib SubDirLinkA systemlib @@ -595,6 +600,7 @@ export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 te testLib4lib testLib4libdbg testLib4libopt testLibCycleA testLibCycleB testLibNoSONAME + testMod1 testMod2 testLibPerConfigDest NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt index a8a98fc..e64c6b4 100644 --- a/Tests/ExportImport/Import/CMakeLists.txt +++ b/Tests/ExportImport/Import/CMakeLists.txt @@ -26,3 +26,6 @@ add_subdirectory(Interface) # Test package version range add_subdirectory(version_range) + +# Test install(IMPORTED_RUNTIME_ARTIFACTS) +add_subdirectory(install-IMPORTED_RUNTIME_ARTIFACTS) diff --git a/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/CMakeLists.txt b/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/CMakeLists.txt new file mode 100644 index 0000000..76efe2f --- /dev/null +++ b/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/CMakeLists.txt @@ -0,0 +1,30 @@ +# Import targets from the exported build tree. +include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake) + +set(_tgts + bld_testExe1 # Ordinary executable + bld_testExe2lib # Ordinary shared library + bld_testLib3 # Shared library with version and soversion + bld_testLib4 # Framework library + bld_testExe3 # Bundle executable + bld_testMod1 # Module library + bld_testMod2 # CFBundle + ) + +install(IMPORTED_RUNTIME_ARTIFACTS ${_tgts} + RUNTIME DESTINATION aaa/executables + LIBRARY DESTINATION aaa/libraries + BUNDLE DESTINATION aaa/bundles + FRAMEWORK DESTINATION aaa/frameworks + ) + +install(IMPORTED_RUNTIME_ARTIFACTS ${_tgts} + DESTINATION bbb + ) + +install(IMPORTED_RUNTIME_ARTIFACTS ${_tgts} + BUNDLE DESTINATION zzz/bundles + FRAMEWORK DESTINATION zzz/frameworks + ) + +install(SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/check_installed.cmake") diff --git a/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/check_installed.cmake b/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/check_installed.cmake new file mode 100644 index 0000000..29b298f --- /dev/null +++ b/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/check_installed.cmake @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.20) + +function(check_installed expect) + file(GLOB_RECURSE actual + LIST_DIRECTORIES TRUE + RELATIVE ${CMAKE_INSTALL_PREFIX} + ${CMAKE_INSTALL_PREFIX}/* + ) + if(actual) + list(SORT actual) + endif() + if(NOT "${actual}" MATCHES "${expect}") + message(FATAL_ERROR "Installed files: + ${actual} +do not match what we expected: + ${expect} +in directory: + ${CMAKE_INSTALL_PREFIX}") + endif() +endfunction() + +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + set(_dirs [[aaa;aaa/executables;aaa/executables/testExe1-4;aaa/executables/testExe3;aaa/libraries;aaa/libraries/libtestExe2lib\.so;aaa/libraries/libtestLib3lib(-d|-r)?\.so\.1\.2;aaa/libraries/libtestLib3lib(-d|-r)?\.so\.3;aaa/libraries/libtestLib4\.so;aaa/libraries/libtestMod1\.so;aaa/libraries/libtestMod2\.so]]) + set(_alldest [[bbb;bbb/libtestExe2lib\.so;bbb/libtestLib3lib(-d|-r)?\.so\.1\.2;bbb/libtestLib3lib(-d|-r)?\.so\.3;bbb/libtestLib4\.so;bbb/libtestMod1\.so;bbb/libtestMod2\.so;bbb/testExe1-4;bbb/testExe3]]) + set(_default [[bin;bin/testExe1-4;bin/testExe3;lib;lib/libtestExe2lib\.so;lib/libtestLib3lib(-d|-r)?\.so\.1\.2;lib/libtestLib3lib(-d|-r)?\.so\.3;lib/libtestLib4\.so;lib/libtestMod1\.so;lib/libtestMod2\.so]]) + check_installed("^${_dirs};${_alldest};${_default}$") +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + set(_dirs_msvc [[aaa;aaa/executables;aaa/executables/testExe1\.exe;aaa/executables/testExe2lib\.dll;aaa/executables/testExe3\.exe;aaa/executables/testLib3dll(-d|-r)?\.dll;aaa/executables/testLib4\.dll;aaa/libraries;aaa/libraries/testMod1\.dll;aaa/libraries/testMod2\.dll]]) + set(_dirs_mingw [[aaa;aaa/executables;aaa/executables/libtestExe2lib\.dll;aaa/executables/libtestLib3dll(-d|-r)?\.dll;aaa/executables/libtestLib4\.dll;aaa/executables/testExe1\.exe;aaa/executables/testExe3\.exe;aaa/libraries;aaa/libraries/libtestMod1\.dll;aaa/libraries/libtestMod2\.dll]]) + + set(_alldest_msvc [[bbb;bbb/testExe1\.exe;bbb/testExe2lib\.dll;bbb/testExe3\.exe;bbb/testLib3dll(-d|-r)?\.dll;bbb/testLib4\.dll;bbb/testMod1\.dll;bbb/testMod2\.dll]]) + set(_alldest_mingw [[bbb;bbb/libtestExe2lib\.dll;bbb/libtestLib3dll(-d|-r)?\.dll;bbb/libtestLib4\.dll;bbb/libtestMod1\.dll;bbb/libtestMod2\.dll;bbb/testExe1\.exe;bbb/testExe3\.exe]]) + + set(_default_msvc [[bin;bin/testExe1\.exe;bin/testExe2lib\.dll;bin/testExe3\.exe;bin/testLib3dll(-d|-r)?\.dll;bin/testLib4\.dll;lib;lib/testMod1\.dll;lib/testMod2\.dll]]) + set(_default_mingw [[bin;bin/libtestExe2lib\.dll;bin/libtestLib3dll(-d|-r)?\.dll;bin/libtestLib4\.dll;bin/testExe1\.exe;bin/testExe3\.exe;lib;lib/libtestMod1\.dll;lib/libtestMod2\.dll]]) + + check_installed("^(${_dirs_msvc};${_alldest_msvc};${_default_msvc}|${_dirs_mingw};${_alldest_mingw};${_default_mingw})$") +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(_bundles [[aaa/bundles;aaa/bundles/testExe3\.app;aaa/bundles/testExe3\.app/Contents;aaa/bundles/testExe3\.app/Contents/Info\.plist;aaa/bundles/testExe3\.app/Contents/MacOS;aaa/bundles/testExe3\.app/Contents/MacOS/testExe3(;aaa/bundles/testExe3\.app/Contents/PkgInfo)?(;aaa/bundles/testExe3\.app/Contents/_CodeSignature;aaa/bundles/testExe3\.app/Contents/_CodeSignature/CodeResources)?]]) + set(_executables [[aaa/executables;aaa/executables/testExe1(-4)?]]) + set(_frameworks [[aaa/frameworks;aaa/frameworks/testLib4\.framework;aaa/frameworks/testLib4\.framework/Headers;aaa/frameworks/testLib4\.framework/Headers/testLib4\.h;aaa/frameworks/testLib4\.framework/Resources;aaa/frameworks/testLib4\.framework/Versions;aaa/frameworks/testLib4\.framework/Versions/A;aaa/frameworks/testLib4\.framework/Versions/A/Resources;aaa/frameworks/testLib4\.framework/Versions/A/Resources/Info\.plist(;aaa/frameworks/testLib4\.framework/Versions/A/_CodeSignature;aaa/frameworks/testLib4\.framework/Versions/A/_CodeSignature/CodeResources)?;aaa/frameworks/testLib4\.framework/Versions/A/testLib4;aaa/frameworks/testLib4\.framework/Versions/Current;aaa/frameworks/testLib4\.framework/testLib4]]) + set(_libraries [[aaa/libraries;aaa/libraries/libtestExe2lib\.dylib;aaa/libraries/libtestLib3lib(-d|-r)?\.1\.2\.dylib;aaa/libraries/libtestLib3lib(-d|-r)?\.3\.dylib;aaa/libraries/libtestMod1\.so;aaa/libraries/testMod2\.bundle;aaa/libraries/testMod2\.bundle/Contents;aaa/libraries/testMod2\.bundle/Contents/Info\.plist;aaa/libraries/testMod2\.bundle/Contents/MacOS;aaa/libraries/testMod2\.bundle/Contents/MacOS/testMod2(;aaa/libraries/testMod2\.bundle/Contents/_CodeSignature;aaa/libraries/testMod2\.bundle/Contents/_CodeSignature/CodeResources)?]]) + set(_dirs "aaa;${_bundles};${_executables};${_frameworks};${_libraries}") + + set(_alldest [[bbb;bbb/libtestExe2lib\.dylib;bbb/libtestLib3lib(-d|-r)?\.1\.2\.dylib;bbb/libtestLib3lib(-d|-r)?\.3\.dylib;bbb/libtestMod1\.so;bbb/testExe1(-4)?;bbb/testExe3\.app;bbb/testExe3\.app/Contents;bbb/testExe3\.app/Contents/Info\.plist;bbb/testExe3\.app/Contents/MacOS;bbb/testExe3\.app/Contents/MacOS/testExe3(;bbb/testExe3\.app/Contents/PkgInfo)?(;bbb/testExe3\.app/Contents/_CodeSignature;bbb/testExe3\.app/Contents/_CodeSignature/CodeResources)?;bbb/testLib4\.framework;bbb/testLib4\.framework/Headers;bbb/testLib4\.framework/Headers/testLib4\.h;bbb/testLib4\.framework/Resources;bbb/testLib4\.framework/Versions;bbb/testLib4\.framework/Versions/A;bbb/testLib4\.framework/Versions/A/Resources;bbb/testLib4\.framework/Versions/A/Resources/Info\.plist(;bbb/testLib4\.framework/Versions/A/_CodeSignature;bbb/testLib4\.framework/Versions/A/_CodeSignature/CodeResources)?;bbb/testLib4\.framework/Versions/A/testLib4;bbb/testLib4\.framework/Versions/Current;bbb/testLib4\.framework/testLib4;bbb/testMod2\.bundle;bbb/testMod2\.bundle/Contents;bbb/testMod2\.bundle/Contents/Info\.plist;bbb/testMod2\.bundle/Contents/MacOS;bbb/testMod2\.bundle/Contents/MacOS/testMod2(;bbb/testMod2\.bundle/Contents/_CodeSignature;bbb/testMod2\.bundle/Contents/_CodeSignature/CodeResources)?]]) + + set(_default_bin [[bin;bin/testExe1(-4)?]]) + set(_default_lib [[lib;lib/libtestExe2lib\.dylib;lib/libtestLib3lib(-d|-r)?\.1\.2\.dylib;lib/libtestLib3lib(-d|-r)?\.3\.dylib;lib/libtestMod1\.so;lib/testMod2\.bundle;lib/testMod2\.bundle/Contents;lib/testMod2\.bundle/Contents/Info\.plist;lib/testMod2\.bundle/Contents/MacOS;lib/testMod2\.bundle/Contents/MacOS/testMod2(;lib/testMod2\.bundle/Contents/_CodeSignature;lib/testMod2\.bundle/Contents/_CodeSignature/CodeResources)?]]) + set(_default_bundles [[zzz/bundles;zzz/bundles/testExe3\.app;zzz/bundles/testExe3\.app/Contents;zzz/bundles/testExe3\.app/Contents/Info\.plist;zzz/bundles/testExe3\.app/Contents/MacOS;zzz/bundles/testExe3\.app/Contents/MacOS/testExe3(;zzz/bundles/testExe3\.app/Contents/PkgInfo)?(;zzz/bundles/testExe3\.app/Contents/_CodeSignature;zzz/bundles/testExe3\.app/Contents/_CodeSignature/CodeResources)?]]) + set(_default_frameworks [[zzz/frameworks;zzz/frameworks/testLib4\.framework;zzz/frameworks/testLib4\.framework/Headers;zzz/frameworks/testLib4\.framework/Headers/testLib4\.h;zzz/frameworks/testLib4\.framework/Resources;zzz/frameworks/testLib4\.framework/Versions;zzz/frameworks/testLib4\.framework/Versions/A;zzz/frameworks/testLib4\.framework/Versions/A/Resources;zzz/frameworks/testLib4\.framework/Versions/A/Resources/Info\.plist(;zzz/frameworks/testLib4\.framework/Versions/A/_CodeSignature;zzz/frameworks/testLib4\.framework/Versions/A/_CodeSignature/CodeResources)?;zzz/frameworks/testLib4\.framework/Versions/A/testLib4;zzz/frameworks/testLib4\.framework/Versions/Current;zzz/frameworks/testLib4\.framework/testLib4]]) + set(_default "${_default_bin};${_default_lib};zzz;${_default_bundles};${_default_frameworks}") + + # Need to break this up due to too many pairs of parentheses + check_installed("^${_dirs};bbb;") + check_installed(";${_alldest};bin;") + check_installed(";${_default}$") +endif() diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 74f34e4..06167a8 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -74,4 +74,6 @@ target_link_libraries(UseABstaticObjs ABstatic) add_subdirectory(ExportLanguages) +add_subdirectory(LinkObjects) + add_subdirectory(Transitive) diff --git a/Tests/ObjectLibrary/LinkObjects/CMakeLists.txt b/Tests/ObjectLibrary/LinkObjects/CMakeLists.txt new file mode 100644 index 0000000..899be45 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/CMakeLists.txt @@ -0,0 +1,45 @@ +add_executable(LinkObjects main.c) + +# Link TARGET_OBJECTS through LINK_LIBRARIES. +add_library(LinkObjectsAObj OBJECT a_obj.c) +add_library(LinkObjectsADep STATIC a_dep.c) +target_compile_definitions(LinkObjectsAObj PUBLIC OBJA) +target_link_libraries(LinkObjects PRIVATE LinkObjectsADep $<TARGET_OBJECTS:LinkObjectsAObj>) + +# Link TARGET_OBJECTS through INTERFACE_LINK_LIBRARIES with usage requirements. +add_library(LinkObjectsB INTERFACE) +add_library(LinkObjectsBObj OBJECT b_obj.c) +add_library(LinkObjectsBDep STATIC b_dep.c) +target_compile_definitions(LinkObjectsBObj PUBLIC OBJB) +target_link_libraries(LinkObjectsB INTERFACE LinkObjectsBObj $<TARGET_OBJECTS:LinkObjectsBObj>) +target_link_libraries(LinkObjectsBObj PRIVATE LinkObjectsBDep) +target_link_libraries(LinkObjects PRIVATE LinkObjectsB) + +# Link TARGET_OBJECTS through INTERFACE_LINK_LIBRARIES without usage requirements. +add_library(LinkObjectsC INTERFACE) +add_library(LinkObjectsCObj OBJECT c_obj.c) +add_library(LinkObjectsCDep STATIC c_dep.c) +target_compile_definitions(LinkObjectsCObj PUBLIC OBJC) +target_link_libraries(LinkObjectsC INTERFACE LinkObjectsCDep $<TARGET_OBJECTS:LinkObjectsCObj>) +target_link_libraries(LinkObjectsCObj PRIVATE LinkObjectsCDep) +target_link_libraries(LinkObjects PRIVATE LinkObjectsC) + +# Link TARGET_OBJECTS through both LINK_LIBRARIES and INTERFACE_LINK_LIBRARIES, deduplicated. +add_library(LinkObjectsD INTERFACE) +add_library(LinkObjectsDObj OBJECT d_obj.c) +add_library(LinkObjectsDDep STATIC d_dep.c) +target_compile_definitions(LinkObjectsDObj PUBLIC OBJD) +target_link_libraries(LinkObjectsD INTERFACE LinkObjectsDObj $<TARGET_OBJECTS:LinkObjectsDObj>) +target_link_libraries(LinkObjectsDObj PRIVATE LinkObjectsDDep) +target_link_libraries(LinkObjects PRIVATE $<TARGET_OBJECTS:LinkObjectsDObj> LinkObjectsD) + +# Link TARGET_OBJECTS through STATIC library private dependency. +add_library(LinkObjectsE INTERFACE) +add_library(LinkObjectsEObj OBJECT e_obj.c) +add_library(LinkObjectsEDep STATIC e_dep.c) +add_library(LinkObjectsEStatic STATIC e_lib.c) +target_compile_definitions(LinkObjectsEObj PUBLIC OBJE) +target_link_libraries(LinkObjectsE INTERFACE LinkObjectsEObj $<TARGET_OBJECTS:LinkObjectsEObj>) +target_link_libraries(LinkObjectsEObj PRIVATE LinkObjectsEDep) +target_link_libraries(LinkObjectsEStatic PRIVATE LinkObjectsE) +target_link_libraries(LinkObjects PRIVATE LinkObjectsEStatic) diff --git a/Tests/ObjectLibrary/LinkObjects/a_dep.c b/Tests/ObjectLibrary/LinkObjects/a_dep.c new file mode 100644 index 0000000..0128740 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/a_dep.c @@ -0,0 +1,7 @@ +#ifdef OBJA +# error "OBJA is defined, but should not be" +#endif +int a_dep(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/LinkObjects/a_obj.c b/Tests/ObjectLibrary/LinkObjects/a_obj.c new file mode 100644 index 0000000..5e79c60 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/a_obj.c @@ -0,0 +1,8 @@ +#ifndef OBJA +# error "OBJA is not defined, but should be" +#endif +extern int a_dep(void); +int a_obj(void) +{ + return a_dep(); +} diff --git a/Tests/ObjectLibrary/LinkObjects/b_dep.c b/Tests/ObjectLibrary/LinkObjects/b_dep.c new file mode 100644 index 0000000..ad5d367 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/b_dep.c @@ -0,0 +1,7 @@ +#ifdef OBJB +# error "OBJB is defined, but should not be" +#endif +int b_dep(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/LinkObjects/b_obj.c b/Tests/ObjectLibrary/LinkObjects/b_obj.c new file mode 100644 index 0000000..d0f426a --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/b_obj.c @@ -0,0 +1,8 @@ +#ifndef OBJB +# error "OBJB is not defined, but should be" +#endif +extern int b_dep(void); +int b_obj(void) +{ + return b_dep(); +} diff --git a/Tests/ObjectLibrary/LinkObjects/c_dep.c b/Tests/ObjectLibrary/LinkObjects/c_dep.c new file mode 100644 index 0000000..1d99ab8 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/c_dep.c @@ -0,0 +1,7 @@ +#ifdef OBJC +# error "OBJC is defined, but should not be" +#endif +int c_dep(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/LinkObjects/c_obj.c b/Tests/ObjectLibrary/LinkObjects/c_obj.c new file mode 100644 index 0000000..08fa5f5 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/c_obj.c @@ -0,0 +1,8 @@ +#ifndef OBJC +# error "OBJC is not defined, but should be" +#endif +extern int c_dep(void); +int c_obj(void) +{ + return c_dep(); +} diff --git a/Tests/ObjectLibrary/LinkObjects/d_dep.c b/Tests/ObjectLibrary/LinkObjects/d_dep.c new file mode 100644 index 0000000..cf09314 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/d_dep.c @@ -0,0 +1,7 @@ +#ifdef OBJD +# error "OBJD is defined, but should not be" +#endif +int d_dep(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/LinkObjects/d_obj.c b/Tests/ObjectLibrary/LinkObjects/d_obj.c new file mode 100644 index 0000000..d14ce66 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/d_obj.c @@ -0,0 +1,8 @@ +#ifndef OBJD +# error "OBJD is not defined, but should be" +#endif +extern int d_dep(void); +int d_obj(void) +{ + return d_dep(); +} diff --git a/Tests/ObjectLibrary/LinkObjects/e_dep.c b/Tests/ObjectLibrary/LinkObjects/e_dep.c new file mode 100644 index 0000000..7fb70c1 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/e_dep.c @@ -0,0 +1,7 @@ +#ifdef OBJE +# error "OBJE is defined, but should not be" +#endif +int e_dep(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/LinkObjects/e_lib.c b/Tests/ObjectLibrary/LinkObjects/e_lib.c new file mode 100644 index 0000000..9bb3a44 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/e_lib.c @@ -0,0 +1,5 @@ +extern int e_obj(void); +int e_lib(void) +{ + return e_obj(); +} diff --git a/Tests/ObjectLibrary/LinkObjects/e_obj.c b/Tests/ObjectLibrary/LinkObjects/e_obj.c new file mode 100644 index 0000000..02624eb --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/e_obj.c @@ -0,0 +1,8 @@ +#ifndef OBJE +# error "OBJE is not defined, but should be" +#endif +extern int e_dep(void); +int e_obj(void) +{ + return e_dep(); +} diff --git a/Tests/ObjectLibrary/LinkObjects/main.c b/Tests/ObjectLibrary/LinkObjects/main.c new file mode 100644 index 0000000..c09c4f1 --- /dev/null +++ b/Tests/ObjectLibrary/LinkObjects/main.c @@ -0,0 +1,24 @@ +#ifdef OBJA +# error "OBJA is defined, but should not be" +#endif +#ifndef OBJB +# error "OBJB is not defined, but should be" +#endif +#ifdef OBJC +# error "OBJC is defined, but should not be" +#endif +#ifndef OBJD +# error "OBJD is not defined, but should be" +#endif +#ifdef OBJE +# error "OBJE is defined, but should not be" +#endif +extern int a_obj(void); +extern int b_obj(void); +extern int c_obj(void); +extern int d_obj(void); +extern int e_lib(void); +int main(void) +{ + return a_obj() + b_obj() + c_obj() + d_obj() + e_lib(); +} diff --git a/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt new file mode 100644 index 0000000..e6f9325 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt @@ -0,0 +1,3 @@ +Cannot find file: [^ +]*/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-build/DartConfiguration.tcl +Binary directory is not set. No coverage checking will be performed.$ diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index afec011..4b654f8 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -360,6 +360,10 @@ run_NoTests() # Check the configuration type variable is passed run_ctest(check-configuration-type) +run_cmake_command(EmptyDirCoverage-ctest + ${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage + ) + function(run_MemCheckSan case opts) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MemCheckSan${case}-build) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index b9a1fbf..9911ad5 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -644,7 +644,7 @@ def gen_check_directories(c, g): if sys.platform not in ("win32", "cygwin", "msys"): for e in expected: - e["installers"] = list(filter(lambda i: "_dllExtra" not in i or not i["_dllExtra"], e["installers"])) + e["installers"] = list(filter(lambda i: not i.get("_dllExtra", False), e["installers"])) if "aix" not in sys.platform: for i in e["installers"]: if "pathsNamelink" in i: diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json index d127274..92b9526 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json @@ -14,6 +14,67 @@ ], "projectName": "Imported", "minimumCMakeVersion": "3.12", - "hasInstallRule": null, - "installers": [] + "hasInstallRule": true, + "installers": [ + { + "component": "Unspecified", + "type": "importedRuntimeArtifacts", + "destination": "lib", + "paths": null, + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 32, + "command": "install", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "importedRuntimeArtifacts", + "destination": "lib2", + "paths": null, + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": true, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 35, + "command": "install", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] } diff --git a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt index f79d87c..770838b 100644 --- a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt @@ -28,3 +28,10 @@ endif() add_library(imported_interface_lib INTERFACE IMPORTED) add_executable(link_imported_interface_exe ../empty.c) target_link_libraries(link_imported_interface_exe PRIVATE imported_interface_lib) + +install(IMPORTED_RUNTIME_ARTIFACTS imported_shared_lib + DESTINATION lib +) +install(IMPORTED_RUNTIME_ARTIFACTS imported_shared_lib + DESTINATION lib2 OPTIONAL +) diff --git a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake index 9a38b95..1ce723b 100644 --- a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake +++ b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake @@ -5,10 +5,6 @@ function(run_transform_depfile name) run_cmake_command(${name}-gcc ${CMAKE_COMMAND} -E cmake_transform_depfile "${RunCMake_GENERATOR}" gccdepfile "${RunCMake_SOURCE_DIR}" "${RunCMake_SOURCE_DIR}/subdir" "${RunCMake_BINARY_DIR}" "${RunCMake_BINARY_DIR}/subdir" "${CMAKE_CURRENT_LIST_DIR}/${name}.d" out.d ) - set(RunCMake-check-file vstlog.cmake) - run_cmake_command(${name}-tlog - ${CMAKE_COMMAND} -E cmake_transform_depfile "${RunCMake_GENERATOR}" vstlog "${RunCMake_SOURCE_DIR}" "${RunCMake_SOURCE_DIR}/subdir" "${RunCMake_BINARY_DIR}" "${RunCMake_BINARY_DIR}/subdir" "${CMAKE_CURRENT_LIST_DIR}/${name}.d" out.tlog - ) endfunction() if(WIN32) diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index 9c59b4b..ad6b258 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -43,3 +43,20 @@ if(NOT RunCMake_GENERATOR STREQUAL "Ninja Multi-Config") unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) endif() + +function(test_genex name) + run_cmake(${name}) + + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}-build") + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) + + if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/wdir/touched") + message(SEND_ERROR "File not created by target-dependent add_custom_command()!") + endif() + + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_BINARY_DIR) +endfunction() + +test_genex(TargetGenexEvent) diff --git a/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake b/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake new file mode 100644 index 0000000..8591b74 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake @@ -0,0 +1,10 @@ +add_custom_target(target ALL) +set_target_properties(target PROPERTIES COMPILE_DEFINITIONS "touched" COMPILE_OPTIONS "${CMAKE_BINARY_DIR}/wdir") +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/wdir") + +add_custom_command( + TARGET target + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E touch $<TARGET_PROPERTY:COMPILE_DEFINITIONS> + WORKING_DIRECTORY $<TARGET_PROPERTY:COMPILE_OPTIONS> +) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake index 763d57c..c71b9ba 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake @@ -11,7 +11,26 @@ function(run_install_test case) run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config Debug) # Check "all" components. set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-all) - run_cmake_command(${case}-all ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake) + run_cmake_command(${case}-all ${CMAKE_COMMAND} --install . --prefix ${CMAKE_INSTALL_PREFIX} --config Debug) +endfunction() + +# Function to check the contents of the output files. +function(check_contents filename contents_regex) + if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}") + file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents) + if(NOT contents MATCHES "${contents_regex}") + string(APPEND RunCMake_TEST_FAILED "File contents: + ${contents} +do not match what we expected: + ${contents_regex} +in file: + ${CMAKE_INSTALL_PREFIX}/${filename}\n") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) + endif() + else() + string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) + endif() endfunction() if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") @@ -20,6 +39,7 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") run_install_test(macos-unresolved) run_install_test(macos-conflict) run_install_test(macos-notfile) + run_install_test(file-filter) endif() run_cmake(project) run_cmake(badargs1) @@ -29,6 +49,7 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") run_install_test(windows-unresolved) run_install_test(windows-conflict) run_install_test(windows-notfile) + run_install_test(file-filter) run_cmake(project) run_cmake(badargs1) run_cmake(badargs2) @@ -41,6 +62,7 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") if(NOT CMAKE_C_COMPILER_ID MATCHES "^XL") run_install_test(linux) + run_install_test(file-filter) endif() run_install_test(linux-unresolved) run_install_test(linux-conflict) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake index ac6af85..f80829d 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake @@ -11,5 +11,7 @@ file(GET_RUNTIME_DEPENDENCIES PRE_EXCLUDE_REGEXES POST_INCLUDE_REGEXES POST_EXCLUDE_REGEXES + POST_INCLUDE_FILES + POST_EXCLUDE_FILES ) message(FATAL_ERROR "This message should not be displayed") diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-all-check.cmake new file mode 100644 index 0000000..9622f87 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-all-check.cmake @@ -0,0 +1,28 @@ +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + set(_check + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep1\.so]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep2\.so]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep3\.so]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep4\.so]] + ) + check_contents(deps/deps.txt "^${_check}$") +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(_check + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep1\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep2\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep3\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep4\.dylib]] + ) + check_contents(deps/deps.txt "^${_check}$") +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + set(_check + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/(lib)?dep1\.dll]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/(lib)?dep2\.dll]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/(lib)?dep3\.dll]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/(lib)?dep4\.dll]] + ) + check_contents(deps/deps.txt "^${_check}$") +endif() + +check_contents(deps/udeps.txt "^$") +check_contents(deps/cdeps.txt "^$") diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter.cmake new file mode 100644 index 0000000..fef084b --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter.cmake @@ -0,0 +1,104 @@ +enable_language(C) + +set(dep_list) +set(import_list) +set(call_list) +foreach(i 1 2 3 4 5 6 7 8 9) + file(WRITE "${CMAKE_BINARY_DIR}/dep${i}.c" +"#ifdef _WIN32 +__declspec(dllexport) +#endif + void dep${i}(void) +{ +} +") + add_library(dep${i} SHARED "${CMAKE_BINARY_DIR}/dep${i}.c") + list(APPEND dep_list dep${i}) + string(APPEND import_list "EXE_IMPORT extern void dep${i}(void);\n") + string(APPEND call_list " dep${i}();\n") +endforeach() +set_target_properties(dep5 PROPERTIES + VERSION 1.2.3 + SOVERSION 1 + ) + +file(WRITE "${CMAKE_BINARY_DIR}/main.c" +"#ifdef _WIN32 +# define EXE_IMPORT __declspec(dllimport) +#else +# define EXE_IMPORT +#endif + +${import_list} +int main(void) +{ +${call_list} + return 0; +} +") + +add_executable(exe "${CMAKE_BINARY_DIR}/main.c") +target_link_libraries(exe PRIVATE ${dep_list}) + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set_property(TARGET exe PROPERTY INSTALL_RPATH "\${ORIGIN}/../lib") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_property(TARGET exe PROPERTY INSTALL_RPATH "@loader_path/../lib") +endif() + +install(TARGETS exe ${dep_list}) + +install(CODE + [[ + function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile) + file(GET_RUNTIME_DEPENDENCIES + RESOLVED_DEPENDENCIES_VAR deps + UNRESOLVED_DEPENDENCIES_VAR udeps + CONFLICTING_DEPENDENCIES_PREFIX cdeps + PRE_INCLUDE_REGEXES "dep[123456789]" + PRE_EXCLUDE_REGEXES ".*" + POST_INCLUDE_REGEXES "dep9" + POST_INCLUDE_FILES + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep1>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep1>" + "${CMAKE_INSTALL_PREFIX}/bin/../bin/$<TARGET_FILE_NAME:dep2>" + "${CMAKE_INSTALL_PREFIX}/bin/../lib/$<TARGET_FILE_NAME:dep2>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep3>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep3>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep8>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep8>" + POST_EXCLUDE_FILES + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep3>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep3>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep5>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep5>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep6>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep6>" + "${CMAKE_INSTALL_PREFIX}/bin/../bin/$<TARGET_FILE_NAME:dep7>" + "${CMAKE_INSTALL_PREFIX}/bin/../lib/$<TARGET_FILE_NAME:dep7>" + POST_EXCLUDE_FILES_STRICT + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep8>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep8>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep9>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep9>" + ${ARGN} + ) + list(SORT deps) + list(SORT udeps) + list(SORT cdeps_FILENAMES) + file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${depsfile}" "${deps}") + file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${udepsfile}" "${udeps}") + file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "") + foreach(cdep IN LISTS cdeps_FILENAMES) + set(cdep_values ${cdeps_${cdep}}) + list(SORT cdep_values) + file(APPEND "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "${cdep}:${cdep_values}\n") + endforeach() + endfunction() + + exec_get_runtime_dependencies( + deps.txt udeps.txt cdeps.txt + EXECUTABLES + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:exe>" + ) + ]]) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-all-check.cmake index 381b602..d3d1cd6 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-all-check.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-all-check.cmake @@ -1,21 +1,3 @@ -function(check_contents filename contents_regex) - if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}") - file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents) - if(NOT contents MATCHES "${contents_regex}") - string(APPEND RunCMake_TEST_FAILED "File contents: - ${contents} -do not match what we expected: - ${contents_regex} -in file: - ${CMAKE_INSTALL_PREFIX}/${filename}\n") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() - else() - string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() -endfunction() - set(_check [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-build/root-all/lib/libtest_rpath\.so]] [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-build/root-all/lib/libtest_runpath\.so]] diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake index e7cdbf6..e9ff9f6 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake @@ -1,21 +1,3 @@ -function(check_contents filename contents_regex) - if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}") - file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents) - if(NOT contents MATCHES "${contents_regex}") - string(APPEND RunCMake_TEST_FAILED "File contents: - ${contents} -do not match what we expected: - ${contents_regex} -in file: - ${CMAKE_INSTALL_PREFIX}/${filename}\n") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() - else() - string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() -endfunction() - function(set_with_libsystem var) set(_tmp "${ARGN}") if(EXISTS "/usr/lib/libSystem.B.dylib") diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake index f1d70a1..cb0e534 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake @@ -1,21 +1,3 @@ -function(check_contents filename contents_regex) - if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}") - file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents) - if(NOT contents MATCHES "${contents_regex}") - string(APPEND RunCMake_TEST_FAILED "File contents: - ${contents} -do not match what we expected: - ${contents_regex} -in file: - ${CMAKE_INSTALL_PREFIX}/${filename}\n") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() - else() - string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() -endfunction() - set(_check [=[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-build/root-all/bin/\.conflict/\.\./(lib)?libdir\.dll]=] [=[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-build/root-all/bin/\.search/(lib)?search\.dll]=] |