Debian Codegraph @

Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake

raw
1 include(RunCMake)
2
3 run_cmake(BadSourceExpression1)
4 run_cmake(BadSourceExpression2)
5 run_cmake(BadSourceExpression3)
6 run_cmake(BadObjSource1)
7 run_cmake(BadObjSource2)
8 if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")
9 run_cmake(ImportMultiArch)
10 run_cmake(InstallNotSupported)
11
12 set(osx_archs $ENV{CMAKE_OSX_ARCHITECTURES})
13 list(GET osx_archs 0 osx_arch)
14 run_cmake_with_options(TargetOverrideSingleArch -Dosx_arch=${osx_arch})
15 else()
16 run_cmake(Import)
17 run_cmake(Install)
18 run_cmake(InstallLinkedObj1)
19 run_cmake(InstallLinkedObj2)
20
21 if(RunCMake_GENERATOR STREQUAL "Xcode" AND XCODE_VERSION VERSION_GREATER_EQUAL 13)
22 run_cmake(TargetOverrideMultiArch)
23 endif()
24 endif()
25
26 run_cmake(Export)
27
28 function (run_object_lib_build name)
29 # Use a single build tree for a few tests without cleaning.
30 set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
31 set(RunCMake_TEST_NO_CLEAN 1)
32 file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
33 file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
34 run_cmake(${name})
35 run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .)
36 endfunction ()
37
38 function (run_object_lib_build2 name)
39 # Use a single build tree for a few tests without cleaning.
40 set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
41 set(RunCMake_TEST_NO_CLEAN 1)
42 file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
43 file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
44 run_cmake(${name})
45 set(RunCMake_TEST_OUTPUT_MERGE 1)
46 run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .)
47 endfunction ()
48
49 if(NOT (RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]"))
50 run_object_lib_build(CheckTargetObjects)
51 endif()
52
53 run_object_lib_build(LinkObjLHSShared)
54 run_object_lib_build(LinkObjLHSStatic)
55 run_object_lib_build(LinkObjRHSShared)
56 run_object_lib_build(LinkObjRHSStatic)
57 run_object_lib_build2(LinkObjRHSObject)
58 run_object_lib_build(LinkObjRHSShared2)
59 run_object_lib_build(LinkObjRHSStatic2)
60 run_object_lib_build2(LinkObjRHSObject2)
61 run_object_lib_build(TransitiveDependencies)
62
63 run_cmake(MissingSource)
64 run_cmake(ObjWithObj)
65 run_cmake(OwnSources)
66 run_cmake(PostBuild)
67 run_cmake(PreBuild)
68 run_cmake(PreLink)
69
70 function(run_Dependencies suffix)
71 set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Dependencies${suffix}-build)
72 set(RunCMake_TEST_NO_CLEAN 1)
73
74 file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
75 file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
76
77 if(RunCMake_GENERATOR STREQUAL "Borland Makefiles" OR
78 RunCMake_GENERATOR STREQUAL "Watcom WMake")
79 set(fs_delay 3)
80 else()
81 set(fs_delay 1.125)
82 endif()
83
84 run_cmake_command(Dependencies${suffix}-build ${CMAKE_COMMAND} -E copy ${RunCMake_SOURCE_DIR}/depends_obj1.c ${RunCMake_TEST_BINARY_DIR}/depends_obj.c)
85 run_cmake_with_options(Dependencies${suffix})
86 run_cmake_command(Dependencies${suffix}-build ${CMAKE_COMMAND} --build . --config Debug)
87 run_cmake_command(Dependencies${suffix}-build ${CMAKE_COMMAND} -E sleep ${fs_delay})
88 run_cmake_command(Dependencies${suffix}-build ${CMAKE_COMMAND} -E copy ${RunCMake_SOURCE_DIR}/depends_obj0.c ${RunCMake_TEST_BINARY_DIR}/depends_obj.c)
89 run_cmake_command(Dependencies${suffix}-build ${CMAKE_COMMAND} --build . --config Debug)
90 run_cmake_command(Dependencies${suffix}-build ${CMAKE_CTEST_COMMAND} -C Debug -V)
91 endfunction()
92
93 run_Dependencies("")
94 if (RunCMake_GENERATOR MATCHES "(Ninja|Makefiles|Visual Studio)")
95 run_Dependencies(Short)
96 endif ()