Skip to content

Instantly share code, notes, and snippets.

@bolry
Created April 15, 2018 08:32
Show Gist options
  • Save bolry/a806bc20079c08203621d40e99f55fc3 to your computer and use it in GitHub Desktop.
Save bolry/a806bc20079c08203621d40e99f55fc3 to your computer and use it in GitHub Desktop.
Example of using copy and "generator" with CMake-files
cmake_minimum_required(VERSION 3.11)
project(LearningCMake)
set(Hmm "${CMAKE_CURRENT_BINARY_DIR}/hmm.cpp")
set(Foo "${CMAKE_CURRENT_BINARY_DIR}/foo.cpp")
set(Bar "${CMAKE_CURRENT_BINARY_DIR}/bar.cpp")
add_executable(LearningCMake ${Hmm} "${Foo}" "${Bar}")
add_custom_command(OUTPUT ${Hmm}
COMMAND cp hmm.xml ${Hmm}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS hmm.xml)
configure_file(foo.txt "${Foo}" COPYONLY)
configure_file(bar.txt "${Bar}" COPYONLY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment