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.
6 OUTPUT ${ExportImport_BINARY_DIR}/CleanupProject
7 COMMAND ${CMAKE_COMMAND} -E remove_directory ${ExportImport_BINARY_DIR}/Root
9 add_custom_target(CleanupTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/CleanupProject)
11 SOURCE ${ExportImport_BINARY_DIR}/CleanupProject
15 if(CMAKE_CONFIGURATION_TYPES)
16 set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}")
17 else(CMAKE_CONFIGURATION_TYPES)
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.
30 OUTPUT ${ExportImport_BINARY_DIR}/ExportProject
31 COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
33 ${ExportImport_SOURCE_DIR}/Export
34 ${ExportImport_BINARY_DIR}/Export
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
42 add_custom_target(ExportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ExportProject)
43 add_dependencies(ExportTarget CleanupTarget)
45 SOURCE ${ExportImport_BINARY_DIR}/ExportProject
49 # Build and install the importer.
51 OUTPUT ${ExportImport_BINARY_DIR}/ImportProject
52 COMMAND ${CMAKE_CTEST_COMMAND} ${NESTED_CONFIG_TYPE}
54 ${ExportImport_SOURCE_DIR}/Import
55 ${ExportImport_BINARY_DIR}/Import
57 --build-project Import
58 --build-generator ${CMAKE_GENERATOR}
59 --build-makeprogram ${CMAKE_MAKE_PROGRAM}
60 --build-options -C${ExportImport_BINARY_DIR}/InitialCache.cmake
62 add_custom_target(ImportTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ImportProject)
63 add_dependencies(ImportTarget ExportTarget)
65 SOURCE ${ExportImport_BINARY_DIR}/ImportProject
69 add_executable(ExportImport main.c)
70 add_dependencies(ExportImport ImportTarget)