{"comment":{"url":"https://api.github.com/repos/PX4/Firmware/comments/18462032","html_url":"https://github.com/PX4/Firmware/commit/e5488f07da07102392bf1e3ab731fe83e560b007#commitcomment-18462032","id":18462032,"user":{"login":"jgoppert","id":473772,"avatar_url":"https://avatars.githubusercontent.com/u/473772?v=3","gravatar_id":"","url":"https://api.github.com/users/jgoppert","html_url":"https://github.com/jgoppert","followers_url":"https://api.github.com/users/jgoppert/followers","following_url":"https://api.github.com/users/jgoppert/following{/other_user}","gists_url":"https://api.github.com/users/jgoppert/gists{/gist_id}","starred_url":"https://api.github.com/users/jgoppert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgoppert/subscriptions","organizations_url":"https://api.github.com/users/jgoppert/orgs","repos_url":"https://api.github.com/users/jgoppert/repos","events_url":"https://api.github.com/users/jgoppert/events{/privacy}","received_events_url":"https://api.github.com/users/jgoppert/received_events","type":"User","site_admin":false},"position":87,"line":181,"path":"cmake/CMakeLists_posix.txt","commit_id":"e5488f07da07102392bf1e3ab731fe83e560b007","created_at":"2016-07-31T00:26:55Z","updated_at":"2016-07-31T00:26:55Z","body":"I think what would be best would be to copy all configs to the binary directory and then install from binary directory to the system. Installing from the source directory doesn't work well for generated files etc.\r\n\r\nHere is an example from another project I'm working on.\r\n\r\n```cmake\r\n###############\r\n## Functions ##\r\n###############\r\nfunction(glob_generate target file_glob)\r\n\tfile(GLOB_RECURSE glob_files RELATIVE ${CMAKE_SOURCE_DIR} ${file_glob})\r\n\tset(gen_files)\r\n\tforeach(glob_file ${glob_files})\r\n\t\tstring(REGEX REPLACE \"\\\\.[^.]*$\" \"\" file_name ${glob_file})\r\n\t\tstring(REGEX MATCH \"[^.]*$\" file_ext ${glob_file})\r\n\t\tget_filename_component(file_dir ${glob_file} DIRECTORY)\r\n\t\tset(in_file ${CMAKE_CURRENT_SOURCE_DIR}/${glob_file})\r\n\t\tset(out_file ${CMAKE_CURRENT_BINARY_DIR}/${glob_file})\r\n\t\tfile(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${file_dir})\r\n\t\tif (${file_ext} STREQUAL \"erb\")\r\n\t\t\tset(out_file ${CMAKE_CURRENT_BINARY_DIR}/${file_name})\r\n\t\t\tadd_custom_command(OUTPUT ${out_file}\r\n\t\t\t\tCOMMAND ${ERB_PROGRAM} ${in_file} > ${out_file}\r\n\t\t\t\tDEPENDS ${in_file}\r\n\t\t\t\tVERBATIM\r\n\t\t\t\t)\r\n\t\telse()\r\n\t\t\tadd_custom_command(OUTPUT ${out_file}\r\n\t\t\t\tCOMMAND ${CMAKE_COMMAND} -E copy ${in_file} ${out_file}\r\n\t\t\t\tDEPENDS ${in_file}\r\n\t\t\t\tVERBATIM\r\n\t\t\t\t)\r\n\t\tendif()\r\n\t\tlist(APPEND gen_files ${out_file})\r\n\tendforeach()\r\n\tadd_custom_target(${target} ALL DEPENDS ${gen_files})\r\nendfunction()\r\n\r\n###########\r\n## Build ##\r\n###########\r\nset(plugins)\r\n\r\n#############\r\n## Install ##\r\n#############\r\n\r\ninstall(TARGETS ${plugins}\r\n  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}\r\n  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}\r\n  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}\r\n)\r\n\r\n\r\nset(gazebo_dir ${CMAKE_INSTALL_DATADIR}/gazebo-${GAZEBO_MAJOR_VERSION})\r\n\r\nglob_generate(models_gen ${CMAKE_SOURCE_DIR}/models/*)\r\nglob_generate(worlds_gen ${CMAKE_SOURCE_DIR}/worlds/*)\r\n\r\ninstall(DIRECTORY ${CMAKE_BINARY_DIR}/models DESTINATION ${gazebo_dir})\r\ninstall(DIRECTORY ${CMAKE_BINARY_DIR}/worlds DESTINATION ${gazebo_dir})\r\n```"}}
{"actor":{"display_login":"jgoppert"}}