Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Tests/CMakeLib/CMakeLists.txt
3148 views
1
# Render the header file with source path macro
2
configure_file(testConfig.h.in testConfig.h @ONLY)
3
4
include_directories(
5
${CMAKE_CURRENT_BINARY_DIR}
6
${CMake_BINARY_DIR}/Source
7
${CMake_SOURCE_DIR}/Source
8
${CMake_SOURCE_DIR}/Source/CTest
9
)
10
11
set(CMakeLib_TESTS
12
testAssert.cxx
13
testArgumentParser.cxx
14
testCTestBinPacker.cxx
15
testCTestResourceAllocator.cxx
16
testCTestResourceSpec.cxx
17
testCTestResourceGroups.cxx
18
testDebug.cxx
19
testDocumentationFormatter.cxx
20
testGccDepfileReader.cxx
21
testGeneratedFileStream.cxx
22
testJSONHelpers.cxx
23
testRST.cxx
24
testRange.cxx
25
testOptional.cxx
26
testPathResolver.cxx
27
testSPDXSerializer.cxx
28
testStdIo.cxx
29
testString.cxx
30
testStringAlgorithms.cxx
31
testSystemTools.cxx
32
testUTF8.cxx
33
testXMLParser.cxx
34
testXMLSafe.cxx
35
testFindPackageCommand.cxx
36
testUVHandlePtr.cxx
37
testUVJobServerClient.cxx
38
testUVPatches.cxx
39
testUVProcessChain.cxx
40
testUVRAII.cxx
41
testUVStreambuf.cxx
42
testCMExtMemory.cxx
43
testCMExtAlgorithm.cxx
44
testCMExtEnumSet.cxx
45
testList.cxx
46
testCMakePath.cxx
47
)
48
if(CMake_ENABLE_DEBUGGER)
49
list(APPEND CMakeLib_TESTS
50
testDebuggerAdapter.cxx
51
testDebuggerAdapterPipe.cxx
52
testDebuggerBreakpointManager.cxx
53
testDebuggerVariables.cxx
54
testDebuggerVariablesHelper.cxx
55
testDebuggerVariablesManager.cxx
56
testDebuggerThread.cxx
57
)
58
endif()
59
if (CMake_TEST_FILESYSTEM_PATH OR NOT CMake_HAVE_CXX_FILESYSTEM)
60
list(APPEND CMakeLib_TESTS testCMFilesystemPath.cxx)
61
endif()
62
63
add_executable(testUVProcessChainHelper testUVProcessChainHelper.cxx)
64
target_link_libraries(testUVProcessChainHelper CMakeLib)
65
target_compile_definitions(testUVProcessChainHelper PRIVATE WIN32_LEAN_AND_MEAN)
66
67
set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
68
set(testUVProcessChain_ARGS $<TARGET_FILE:testUVProcessChainHelper>)
69
set(testUVStreambuf_ARGS $<TARGET_FILE:cmake>)
70
set(testCTestResourceSpec_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
71
set(testGccDepfileReader_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
72
73
if(WIN32)
74
list(APPEND CMakeLib_TESTS
75
testVisualStudioSlnParser.cxx
76
)
77
endif()
78
79
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testUVProcessChainInput.txt" "HELLO WORLD!")
80
81
create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS})
82
add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS})
83
target_link_libraries(CMakeLibTests PRIVATE CTestLib CMakeLib)
84
if(CMake_BUILD_PCH)
85
target_precompile_headers(CMakeLibTests PRIVATE "<iostream>" "<cm3p/uv.h>")
86
target_compile_definitions(CMakeLibTests PRIVATE "NOMINMAX")
87
endif()
88
if(WIN32)
89
target_compile_definitions(CMakeLibTests PRIVATE WIN32_LEAN_AND_MEAN)
90
endif()
91
92
set_property(TARGET CMakeLibTests PROPERTY C_CLANG_TIDY "")
93
set_property(TARGET CMakeLibTests PROPERTY CXX_CLANG_TIDY "")
94
95
add_executable(testEncoding testEncoding.cxx)
96
target_link_libraries(testEncoding cmsys)
97
98
foreach(testfile ${CMakeLib_TESTS})
99
get_filename_component(test "${testfile}" NAME_WE)
100
add_test(NAME CMakeLib.${test} COMMAND CMakeLibTests ${test} ${${test}_ARGS})
101
endforeach()
102
103
if(TEST_CompileCommandOutput)
104
add_executable(runcompilecommands run_compile_commands.cxx)
105
target_link_libraries(runcompilecommands CMakeLib)
106
endif()
107
108
add_subdirectory(PseudoMemcheck)
109
110
add_executable(testAffinity testAffinity.cxx)
111
target_link_libraries(testAffinity CMakeLib)
112
113
if(CMake_ENABLE_DEBUGGER)
114
add_executable(testDebuggerNamedPipe testDebuggerNamedPipe.cxx)
115
target_link_libraries(testDebuggerNamedPipe PRIVATE CMakeLib)
116
set(testDebuggerNamedPipe_Project_ARGS
117
"$<TARGET_FILE:cmake>" -S ${CMAKE_CURRENT_SOURCE_DIR}/DebuggerSample -B ${CMAKE_CURRENT_BINARY_DIR}/DebuggerSample
118
--fresh -G ${CMAKE_GENERATOR}
119
)
120
if(CMAKE_GENERATOR_PLATFORM)
121
list(APPEND testDebuggerNamedPipe_Project_ARGS -A "${CMAKE_GENERATOR_PLATFORM}")
122
endif()
123
if(CMAKE_GENERATOR_TOOLSET)
124
list(APPEND testDebuggerNamedPipe_Project_ARGS -T "${CMAKE_GENERATOR_TOOLSET}")
125
endif()
126
if(CMAKE_GENERATOR_INSTANCE)
127
list(APPEND testDebuggerNamedPipe_Project_ARGS "-DCMAKE_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE}")
128
endif()
129
set(testDebuggerNamedPipe_Script_ARGS
130
"$<TARGET_FILE:cmake>" -P ${CMAKE_CURRENT_SOURCE_DIR}/DebuggerSample/script.cmake
131
)
132
foreach(case Project Script)
133
add_test(NAME CMakeLib.testDebuggerNamedPipe-${case} COMMAND testDebuggerNamedPipe ${testDebuggerNamedPipe_${case}_ARGS})
134
set_property(TEST CMakeLib.testDebuggerNamedPipe-${case} PROPERTY TIMEOUT 300)
135
endforeach()
136
if(WIN32)
137
target_compile_definitions(testDebuggerNamedPipe PRIVATE WIN32_LEAN_AND_MEAN)
138
endif()
139
endif()
140
141