23 lines
728 B
CMake
23 lines
728 B
CMake
# This script is invoked via add_custom_target, like this:
|
|
# cmake -P MakeComposite.cmake -D COMPOSITE_FILE="x_composite1.cxx" -D COMPOSITE_SOURCES="a.cxx b.cxx"
|
|
|
|
if(CMAKE_SCRIPT_MODE_FILE)
|
|
#cmake_minimum_required(VERSION 2.8.4)
|
|
|
|
if(NOT DEFINED COMPOSITE_FILE)
|
|
message(FATAL_ERROR "COMPOSITE_FILE should be defined when running MakeComposite.cmake!")
|
|
return()
|
|
endif()
|
|
|
|
file(WRITE "${COMPOSITE_FILE}" "/* Generated by CMake. DO NOT EDIT. */\n")
|
|
|
|
separate_arguments(COMPOSITE_SOURCES)
|
|
foreach(source ${COMPOSITE_SOURCES})
|
|
file(APPEND "${COMPOSITE_FILE}" "#include \"${source}\"\n")
|
|
endforeach()
|
|
|
|
else()
|
|
message(SEND_ERROR "MakeComposite.cmake should not be included but run in script mode.")
|
|
|
|
endif()
|