2 # export file: copy it to the build tree on every build invocation and add rule for installation
4 function(cm_export_file FILE target_name)
5 if(NOT TARGET ${target_name})
6 add_custom_target(${target_name} ALL COMMENT "Exporting files into build tree")
7 endif (NOT TARGET ${target_name})
8 get_filename_component(FILENAME "${FILE}" NAME)
9 add_custom_command(TARGET ${target_name} COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}")
10 endfunction (cm_export_file)
12 function(cm_export_absolut_path_file FILE target_name)
13 if(NOT TARGET ${target_name})
14 add_custom_target(${target_name} ALL COMMENT "Exporting files into build tree")
15 endif (NOT TARGET ${target_name})
16 get_filename_component(FILENAME "${FILE}" NAME)
17 add_custom_command(TARGET ${target_name} COMMAND ${CMAKE_COMMAND} -E copy_if_different "${FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}")
18 endfunction (cm_export_absolut_path_file)
22 #cm_export_file("API/someHeader0.hpp")
23 #cm_export_file("API/someHeader1.hpp")