Updated formatting of documentation plus a little reorganization.
[cmake.git] / Tests / ExportImport / CMakeLists.txt
blob2e01c50670cc76f8760deb9775d76fd05bd3db31
1 cmake_minimum_required (VERSION 2.7.20090711)
2 project(ExportImport C CXX)
4 # Wipe out the install tree to make sure the exporter works.
5 add_custom_command(
6   OUTPUT ${ExportImport_BINARY_DIR}/CleanupProject
7   COMMAND ${CMAKE_COMMAND} -E remove_directory ${ExportImport_BINARY_DIR}/Root
8   )
9 add_custom_target(CleanupTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/CleanupProject)
10 set_property(
11   SOURCE ${ExportImport_BINARY_DIR}/CleanupProject
12   PROPERTY SYMBOLIC 1
13   )
15 if(CMAKE_CONFIGURATION_TYPES)
16   set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
17 else(CMAKE_CONFIGURATION_TYPES)
18   if(CMAKE_BUILD_TYPE)
19     set(NESTED_CONFIG_TYPE -C "${CMAKE_BUILD_TYPE}")
20   else(CMAKE_BUILD_TYPE)
21     set(NESTED_CONFIG_TYPE)
22   endif(CMAKE_BUILD_TYPE)
23 endif(CMAKE_CONFIGURATION_TYPES)
25 configure_file(${ExportImport_SOURCE_DIR}/InitialCache.cmake.in
26                ${ExportImport_BINARY_DIR}/InitialCache.cmake @ONLY)
28 # Build and install the exporter.
29 add_custom_command(
30   OUTPUT ${ExportImport_BINARY_DIR}/ExportProject
31   COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
32     --build-and-test
33     ${ExportImport_SOURCE_DIR}/Export
34     ${ExportImport_BINARY_DIR}/Export
35     --build-noclean
36     --build-project Export
37     --build-target install
38     --build-generator ${CMAKE_GENERATOR}
39     --build-makeprogram ${CMAKE_MAKE_PROGRAM}
40     --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake
41     )
42 add_custom_target(ExportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ExportProject)
43 add_dependencies(ExportTarget CleanupTarget)
44 set_property(
45   SOURCE ${ExportImport_BINARY_DIR}/ExportProject
46   PROPERTY SYMBOLIC 1
47   )
49 # Build and install the importer.
50 add_custom_command(
51   OUTPUT ${ExportImport_BINARY_DIR}/ImportProject
52   COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
53    --build-and-test
54    ${ExportImport_SOURCE_DIR}/Import
55    ${ExportImport_BINARY_DIR}/Import
56    --build-noclean
57    --build-project Import
58    --build-generator ${CMAKE_GENERATOR}
59    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
60    --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake
61    )
62 add_custom_target(ImportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ImportProject)
63 add_dependencies(ImportTarget ExportTarget)
64 set_property(
65   SOURCE ${ExportImport_BINARY_DIR}/ImportProject
66   PROPERTY SYMBOLIC 1
67   )
69 add_executable(ExportImport main.c)
70 add_dependencies(ExportImport ImportTarget)