6a3c7b9c653337a7caf18425f36f55216b16a14b
[platform/upstream/cmake.git] / Tests / RunCMake / target_sources / RunCMakeTest.cmake
1 include(RunCMake)
2
3 if(RunCMake_GENERATOR STREQUAL "Xcode")
4   run_cmake(ConfigNotAllowed)
5 endif()
6
7 run_cmake(EmptyKeywordArgs)
8 run_cmake(OriginDebug)
9 run_cmake(CMP0026-LOCATION)
10 run_cmake(CMP0076-OLD)
11 run_cmake(CMP0076-WARN)
12 run_cmake(RelativePathInInterface)
13 run_cmake(RelativePathInSubdirGenEx)
14 run_cmake(RelativePathInSubdirInterface)
15 run_cmake(RelativePathInSubdirPrivate)
16 run_cmake(RelativePathInSubdirInclude)
17 run_cmake(ExportBuild)
18 run_cmake(AddCustomTargetPublicSources)
19 run_cmake(AddCustomTargetPrivateSources)
20 run_cmake(AddCustomTargetInterfaceSources)
21 run_cmake(AddCustomTargetSources)
22 run_cmake(AddCustomTargetCheckProperty)
23 run_cmake(AddCustomTargetGenx)
24
25 run_cmake(FileSetProperties)
26 run_cmake(FileSetNoType)
27 run_cmake(FileSetWrongType)
28 run_cmake(FileSetDefaultWrongType)
29 run_cmake(FileSetChangeScope)
30 run_cmake(FileSetChangeType)
31 run_cmake(FileSetWrongBaseDirs)
32 run_cmake(FileSetWrongBaseDirsRelative)
33 run_cmake(FileSetOverlappingBaseDirs)
34 run_cmake(FileSetInstallMissingSetsPrivate)
35 run_cmake(FileSetInstallMissingSetsInterface)
36 run_cmake(FileSetInstallMissingSetsInterfacePostInstall)
37 run_cmake(FileSetExportMissingSetsInterfacePostExport)
38 run_cmake(FileSetReadOnlyPrivate)
39 run_cmake(FileSetReadOnlyInterface)
40 run_cmake(FileSetNoExistInstall)
41 run_cmake(FileSetDirectories)
42 run_cmake(FileSetCustomTarget)
43 run_cmake(FileSetBadName)
44 if(APPLE)
45   run_cmake(FileSetFramework)
46 endif()
47
48 set(RunCMake_TEST_NO_CLEAN 1)
49 set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/FileSetGeneratedDependency-build")
50 file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
51 file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
52 run_cmake(FileSetGeneratedDependency)
53 run_cmake_command(FileSetGeneratedDependency-build ${CMAKE_COMMAND} --build . --config Debug)
54 unset(RunCMake_TEST_BINARY_DIR)
55 unset(RunCMake_TEST_NO_CLEAN)
56
57 set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=NEW)
58 run_cmake(FileSetFileNoExist)
59 unset(RunCMake_TEST_OPTIONS)
60
61 function(run_export_import name)
62   if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
63     set(_config_options "-DCMAKE_CONFIGURATION_TYPES=Debug\\\\;Release")
64   else()
65     set(_config_options -DCMAKE_BUILD_TYPE=Debug)
66   endif()
67
68   set(RunCMake_TEST_NO_CLEAN 1)
69   set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Export-build")
70   set(RunCMake_TEST_OPTIONS "--install-prefix=${RunCMake_TEST_BINARY_DIR}/install" ${_config_options})
71   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
72   file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
73   run_cmake(${name}Export)
74   run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Debug)
75   run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Debug)
76   if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
77     run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --build . --config Release)
78     run_cmake_command(${name}Export-build ${CMAKE_COMMAND} --install . --config Release)
79   endif()
80   unset(RunCMake_TEST_OPTIONS)
81
82   set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}Import-build")
83   unset(RunCMake_TEST_OPTIONS)
84   file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
85   file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
86   run_cmake(${name}Import)
87   run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Debug)
88   if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
89     run_cmake_command(${name}Import-build ${CMAKE_COMMAND} --build . --config Release)
90   endif()
91
92   unset(RunCMake_TEST_BINARY_DIR)
93   unset(RunCMake_TEST_NO_CLEAN)
94 endfunction()
95
96 run_export_import(FileSet)