1d45162d0a576d645a03b7436df71be4fb46d361
[platform/upstream/cmake.git] / Tests / CMakeLib / CMakeLists.txt
1 include_directories(
2   ${CMAKE_CURRENT_BINARY_DIR}
3   ${CMake_BINARY_DIR}/Source
4   ${CMake_SOURCE_DIR}/Source
5   ${CMake_SOURCE_DIR}/Source/CTest
6   )
7
8 set(CMakeLib_TESTS
9   testArgumentParser.cxx
10   testCTestBinPacker.cxx
11   testCTestResourceAllocator.cxx
12   testCTestResourceSpec.cxx
13   testCTestResourceGroups.cxx
14   testGccDepfileReader.cxx
15   testGeneratedFileStream.cxx
16   testJSONHelpers.cxx
17   testRST.cxx
18   testRange.cxx
19   testOptional.cxx
20   testString.cxx
21   testStringAlgorithms.cxx
22   testSystemTools.cxx
23   testUTF8.cxx
24   testXMLParser.cxx
25   testXMLSafe.cxx
26   testFindPackageCommand.cxx
27   testUVProcessChain.cxx
28   testUVRAII.cxx
29   testUVStreambuf.cxx
30   testCMExtMemory.cxx
31   testCMExtAlgorithm.cxx
32   testCMExtEnumSet.cxx
33   )
34 if (CMake_TEST_FILESYSTEM_PATH OR NOT CMake_HAVE_CXX_FILESYSTEM)
35   list(APPEND CMakeLib_TESTS testCMFilesystemPath.cxx)
36 endif()
37
38 add_executable(testUVProcessChainHelper testUVProcessChainHelper.cxx)
39
40 set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
41 set(testUVProcessChain_ARGS $<TARGET_FILE:testUVProcessChainHelper>)
42 set(testUVStreambuf_ARGS $<TARGET_FILE:cmake>)
43 set(testCTestResourceSpec_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
44 set(testGccDepfileReader_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
45
46 if(WIN32)
47   list(APPEND CMakeLib_TESTS
48     testVisualStudioSlnParser.cxx
49     )
50   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testVisualStudioSlnParser.h.in
51                  ${CMAKE_CURRENT_BINARY_DIR}/testVisualStudioSlnParser.h @ONLY)
52 endif()
53
54 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testXMLParser.h.in
55                ${CMAKE_CURRENT_BINARY_DIR}/testXMLParser.h @ONLY)
56
57 create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS})
58 add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS})
59 target_link_libraries(CMakeLibTests CMakeLib CTestLib)
60
61 set_property(TARGET CMakeLibTests PROPERTY C_CLANG_TIDY "")
62 set_property(TARGET CMakeLibTests PROPERTY CXX_CLANG_TIDY "")
63
64 add_executable(testEncoding testEncoding.cxx)
65 target_link_libraries(testEncoding cmsys)
66
67 foreach(testfile ${CMakeLib_TESTS})
68   get_filename_component(test "${testfile}" NAME_WE)
69   add_test(NAME CMakeLib.${test} COMMAND CMakeLibTests ${test} ${${test}_ARGS})
70 endforeach()
71
72 if(TEST_CompileCommandOutput)
73   add_executable(runcompilecommands run_compile_commands.cxx)
74   target_link_libraries(runcompilecommands CMakeLib)
75 endif()
76
77 add_subdirectory(PseudoMemcheck)
78
79 add_executable(testAffinity testAffinity.cxx)
80 target_link_libraries(testAffinity CMakeLib)