diff options
Diffstat (limited to 'Tests/RunCMake')
59 files changed, 262 insertions, 77 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 31069fa..beadb1d 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -339,6 +339,9 @@ add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) add_RunCMake_test(FetchContent) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + set(CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>) +endif() add_RunCMake_test(CTestCommandLine) add_RunCMake_test(CacheNewline) # Only run this test on unix platforms that support diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 0fafea5..3033c9c 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -141,3 +141,23 @@ function(run_TestOutputSize) ) endfunction() run_TestOutputSize() + +function(run_TestAffinity) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestAffinity) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + # Create a test with affinity enabled. The default PROCESSORS + # value is 1, so our expected output checks that this is the + # number of processors in the mask. + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(Affinity \"${TEST_AFFINITY}\") + set_tests_properties(Affinity PROPERTIES PROCESSOR_AFFINITY ON) +") + # Run ctest with a large parallel level so that the value is + # not responsible for capping the number of processors available. + run_cmake_command(TestAffinity ${CMAKE_CTEST_COMMAND} -V -j 64) +endfunction() +if(TEST_AFFINITY) + run_TestAffinity() +endif() diff --git a/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt b/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt new file mode 100644 index 0000000..e23d30b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt @@ -0,0 +1 @@ +1: CPU affinity (mask count is '1'|not supported on this platform)\. diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt deleted file mode 100644 index b91ffd0..0000000 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Error at BadObjSource2.cmake:1 \(add_library\): - OBJECT library "A" contains: - - bad.obj - - but may contain only sources that compile, header files, and other files - that would not affect linking of a normal library. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt index a17c8cd..d1b0d2c 100644 --- a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt +++ b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt b/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt deleted file mode 100644 index 5420159..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at ExportNotSupported.cmake:[0-9]+ \(export\): - export given OBJECT library "A" which may not be exported under Xcode with - multiple architectures. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake b/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake deleted file mode 100644 index a3f104e..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(A OBJECT a.c) -export(TARGETS A FILE AExport.cmake) diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt new file mode 100644 index 0000000..f2f0f94 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt @@ -0,0 +1 @@ +CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in the export set. diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake new file mode 100644 index 0000000..9e24609 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake @@ -0,0 +1,6 @@ +add_library(A OBJECT a.c) +add_library(UseA STATIC) +target_link_libraries(UseA PUBLIC A) + +install(TARGETS UseA EXPORT exp ARCHIVE DESTINATION lib) +install(EXPORT exp DESTINATION lib/cmake/exp) diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake new file mode 100644 index 0000000..cdda962 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake @@ -0,0 +1,6 @@ +add_library(A OBJECT a.c) +add_library(UseA STATIC) +target_link_libraries(UseA PUBLIC A) + +install(TARGETS UseA A EXPORT exp ARCHIVE DESTINATION lib) +install(EXPORT exp DESTINATION lib/cmake/exp) diff --git a/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt index 35a0e4f..a7004c1 100644 --- a/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt @@ -1,5 +1,5 @@ CMake Error at InstallNotSupported.cmake:[0-9]+ \(install\): - install TARGETS given OBJECT library "A" which may not be installed under - Xcode with multiple architectures. + install TARGETS given OBJECT library "A" whose objects may not be installed + under Xcode with multiple architectures. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt deleted file mode 100644 index 90e828b..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at LinkObjLHS.cmake:2 \(target_link_libraries\): - Object library target "AnObjLib" may not link to anything. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake deleted file mode 100644 index 5d7831a..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(AnObjLib OBJECT a.c) -target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake new file mode 100644 index 0000000..4aa7bba --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake @@ -0,0 +1,7 @@ +project(LinkObjLHSShared C) + +add_library(OtherLib SHARED a.c) +target_compile_definitions(OtherLib INTERFACE REQUIRED) + +add_library(AnObjLib OBJECT requires.c) +target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake new file mode 100644 index 0000000..261bee7 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake @@ -0,0 +1,7 @@ +project(LinkObjLHSStatic C) + +add_library(OtherLib STATIC a.c) +target_compile_definitions(OtherLib INTERFACE REQUIRED) + +add_library(AnObjLib OBJECT requires.c) +target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt deleted file mode 100644 index d5ee4f9..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at LinkObjRHS1.cmake:3 \(target_link_libraries\): - Target "AnObjLib" of type OBJECT_LIBRARY may not be linked into another - target. One may link only to INTERFACE, STATIC or SHARED libraries, or to - executables with the ENABLE_EXPORTS property set. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake deleted file mode 100644 index 113d6a8..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake +++ /dev/null @@ -1,3 +0,0 @@ -add_library(A STATIC a.c) -add_library(AnObjLib OBJECT a.c) -target_link_libraries(A AnObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt deleted file mode 100644 index 3295fca..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at LinkObjRHS2.cmake:1 \(add_library\): - Target "A" links to OBJECT library "AnObjLib" but this is not allowed. One - may link only to STATIC or SHARED libraries, or to executables with the - ENABLE_EXPORTS property set. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake deleted file mode 100644 index 6163729..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake +++ /dev/null @@ -1,3 +0,0 @@ -add_library(A SHARED a.c) -target_link_libraries(A AnObjLib) -add_library(AnObjLib OBJECT a.c) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt new file mode 100644 index 0000000..e27f06b --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt @@ -0,0 +1 @@ +[1-9][0-9]* diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt new file mode 100644 index 0000000..4eeb096 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt @@ -0,0 +1 @@ +REQUIRED needs to be defined diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake new file mode 100644 index 0000000..db571a3 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0022 NEW) + +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(AnotherObjLib OBJECT b.c) +target_link_libraries(AnotherObjLib PRIVATE AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe AnotherObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt new file mode 100644 index 0000000..e27f06b --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt @@ -0,0 +1 @@ +[1-9][0-9]* diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake new file mode 100644 index 0000000..6bb8d5e --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0022 NEW) + +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(AnotherObjLib OBJECT b.c) +target_link_libraries(AnotherObjLib PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe AnotherObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake new file mode 100644 index 0000000..b9030b3 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_definitions(-DCOMPILE_FOR_SHARED_LIB) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) +set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON) + +add_library(A SHARED b.c $<TARGET_OBJECTS:AnObjLib>) +target_link_libraries(A PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake new file mode 100644 index 0000000..e2e5fa2 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake @@ -0,0 +1,14 @@ +enable_language(C) + +add_definitions(-DCOMPILE_FOR_SHARED_LIB) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) +set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON) + +add_library(A SHARED b.c) +target_link_libraries(A PRIVATE AnObjLib) +target_compile_definitions(A INTERFACE $<TARGET_PROPERTY:AnObjLib,INTERFACE_COMPILE_DEFINITIONS>) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake new file mode 100644 index 0000000..73fad06 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(A STATIC b.c $<TARGET_OBJECTS:AnObjLib>) +target_link_libraries(A PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake new file mode 100644 index 0000000..9e1ab6d --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake @@ -0,0 +1,11 @@ +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(A STATIC b.c) +target_link_libraries(A PRIVATE AnObjLib) +target_compile_definitions(A INTERFACE $<TARGET_PROPERTY:AnObjLib,INTERFACE_COMPILE_DEFINITIONS>) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt deleted file mode 100644 index d67b4ae..0000000 --- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at ObjWithObj.cmake:2 \(add_library\): - Only executables and non-OBJECT libraries may reference target objects. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index b8eed73..c73732f 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -6,17 +6,46 @@ run_cmake(BadSourceExpression3) run_cmake(BadObjSource1) run_cmake(BadObjSource2) if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") - run_cmake(ExportNotSupported) run_cmake(ImportNotSupported) run_cmake(InstallNotSupported) else() - run_cmake(Export) run_cmake(Import) run_cmake(Install) + run_cmake(InstallLinkedObj1) + run_cmake(InstallLinkedObj2) endif() -run_cmake(LinkObjLHS) -run_cmake(LinkObjRHS1) -run_cmake(LinkObjRHS2) +run_cmake(Export) + +function (run_object_lib_build name) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) +endfunction () + +function (run_object_lib_build2 name) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) +endfunction () + +run_object_lib_build(LinkObjLHSShared) +run_object_lib_build(LinkObjLHSStatic) +run_object_lib_build(LinkObjRHSShared) +run_object_lib_build(LinkObjRHSStatic) +run_object_lib_build2(LinkObjRHSObject) +run_object_lib_build(LinkObjRHSShared2) +run_object_lib_build(LinkObjRHSStatic2) +run_object_lib_build2(LinkObjRHSObject2) + run_cmake(MissingSource) run_cmake(ObjWithObj) run_cmake(OwnSources) diff --git a/Tests/RunCMake/ObjectLibrary/a.c b/Tests/RunCMake/ObjectLibrary/a.c index 1636303..5beb3f1 100644 --- a/Tests/RunCMake/ObjectLibrary/a.c +++ b/Tests/RunCMake/ObjectLibrary/a.c @@ -1,4 +1,10 @@ -int a(void) +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define EXPORT __declspec(dllexport) +#else +#define EXPORT +#endif + +EXPORT int a(void) { return 0; } diff --git a/Tests/RunCMake/ObjectLibrary/b.c b/Tests/RunCMake/ObjectLibrary/b.c index 6751907..7549abf 100644 --- a/Tests/RunCMake/ObjectLibrary/b.c +++ b/Tests/RunCMake/ObjectLibrary/b.c @@ -1,4 +1,14 @@ -int b(void) +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define EXPORT __declspec(dllexport) +#else +#define EXPORT +#endif + +extern int a(void); +EXPORT int b() { - return 0; + return a(); } +#ifndef REQUIRED +#error "REQUIRED needs to be defined" +#endif diff --git a/Tests/RunCMake/ObjectLibrary/exe.c b/Tests/RunCMake/ObjectLibrary/exe.c new file mode 100644 index 0000000..6efdae7 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/exe.c @@ -0,0 +1,14 @@ +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define IMPORT __declspec(dllimport) +#else +#define IMPORT +#endif + +extern IMPORT int b(void); +int main() +{ + return b(); +} +#ifndef REQUIRED +#error "REQUIRED needs to be defined" +#endif diff --git a/Tests/RunCMake/ObjectLibrary/requires.c b/Tests/RunCMake/ObjectLibrary/requires.c new file mode 100644 index 0000000..d524952 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/requires.c @@ -0,0 +1,8 @@ +#ifdef REQUIRED +int required() +{ + return 0; +} +#else +#error "REQUIRED not defined" +#endif diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index e688830..36a122f 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -112,6 +112,8 @@ function(run_cmake test) "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:" "|Error kstat returned" "|Hit xcodebuild bug" + "|ld: 0711-224 WARNING: Duplicate symbol: .__init_aix_libgcc_cxa_atexit" + "|ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information" "|[^\n]*is a member of multiple groups" "|[^\n]*from Time Machine by path" "|[^\n]*Bullseye Testing Technology" diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 8d5139d..5af6fcd 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -23,6 +23,7 @@ \* CMP0065 \* CMP0068 \* CMP0069 + \* CMP0073 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_library/CMP0073-stdout.txt b/Tests/RunCMake/add_library/CMP0073-stdout.txt new file mode 100644 index 0000000..84645b8 --- /dev/null +++ b/Tests/RunCMake/add_library/CMP0073-stdout.txt @@ -0,0 +1,3 @@ +-- warn_LIB_DEPENDS='general;bar;' +-- old_LIB_DEPENDS='general;bar;' +-- new_LIB_DEPENDS='' diff --git a/Tests/RunCMake/add_library/CMP0073.cmake b/Tests/RunCMake/add_library/CMP0073.cmake new file mode 100644 index 0000000..b34f5dc --- /dev/null +++ b/Tests/RunCMake/add_library/CMP0073.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +add_library(warn empty.c) +target_link_libraries(warn bar) +message(STATUS "warn_LIB_DEPENDS='${warn_LIB_DEPENDS}'") + +cmake_policy(SET CMP0073 OLD) +add_library(old empty.c) +target_link_libraries(old bar) +message(STATUS "old_LIB_DEPENDS='${old_LIB_DEPENDS}'") + +cmake_policy(SET CMP0073 NEW) +add_library(new empty.c) +target_link_libraries(new bar) +message(STATUS "new_LIB_DEPENDS='${new_LIB_DEPENDS}'") +if(DEFINED new_LIB_DEPENDS) + message(FATAL_ERROR "new_LIB_DEPENDS set but should not be") +endif() diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt index cd6f1e0..1bcc114 100644 --- a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt @@ -1,5 +1,4 @@ -^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): - Object library target \"TestObjectLibWithoutSources\" may not link to - anything. +^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestObjectLibWithoutSources Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt deleted file mode 100644 index 77a72f1..0000000 --- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt +++ /dev/null @@ -1,16 +0,0 @@ -^CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): - OBJECT library \"TestObjectLibWithoutSources\" contains: - - [^ -]*test(\.cpp)?\.o(bj)? - - but may contain only sources that compile, header files, and other files - that would not affect linking of a normal library. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) - - -CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): - Only executables and non-OBJECT libraries may reference target objects. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/RunCMakeTest.cmake b/Tests/RunCMake/add_library/RunCMakeTest.cmake index 0ba6216..dfadb8f 100644 --- a/Tests/RunCMake/add_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_library/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(CMP0073) + run_cmake(INTERFACEwithNoSources) run_cmake(OBJECTwithNoSources) run_cmake(STATICwithNoSources) diff --git a/Tests/RunCMake/add_library/empty.c b/Tests/RunCMake/add_library/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/add_library/empty.c diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt new file mode 100644 index 0000000..af3cb2e --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-error-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\): + file FOLLOW_SYMLINKS is not a valid parameter for GLOB\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake new file mode 100644 index 0000000..6d467a0 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST FOLLOW_SYMLINKS) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt new file mode 100644 index 0000000..30cec89 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-error-RELATIVE-no-arg\.cmake:[0-9]+ \(file\): + file GLOB requires a directory after the RELATIVE tag\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake new file mode 100644 index 0000000..a555881 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST RELATIVE) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt +++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt new file mode 100644 index 0000000..ee6cb0b --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-noexp-LIST_DIRECTORIES\.cmake:[0-9]+ \(file\): + file GLOB requires a glob expression after the bool\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt new file mode 100644 index 0000000..9c66631 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-noexp-RELATIVE\.cmake:[0-9]+ \(file\): + file GLOB requires a glob expression after the directory\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake b/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake new file mode 100644 index 0000000..7b2d404 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST RELATIVE "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt new file mode 100644 index 0000000..d0b2bff --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB_RECURSE-noexp-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\): + file GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake new file mode 100644 index 0000000..5e5ce92 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake @@ -0,0 +1 @@ +file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS) diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 9a72333..27305d0 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -35,11 +35,15 @@ run_cmake(LOCK-lowercase) run_cmake(READ_ELF) run_cmake(GLOB) run_cmake(GLOB_RECURSE) -# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS) + +# tests are valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-FOLLOW_SYMLINKS) run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) -# test is valid both for GLOB and GLOB_RECURSE run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) +run_cmake(GLOB-error-RELATIVE-no-arg) run_cmake(GLOB-noexp-LIST_DIRECTORIES) +run_cmake(GLOB-noexp-RELATIVE) if(NOT WIN32 OR CYGWIN) run_cmake(GLOB_RECURSE-cyclic-recursion) |