X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fbash%2FCMakeLists.txt;h=aa50398a4d02800c6f00516ecd210083218f9e55;hb=77d3666adac324c796ec446fd21179bd8619b39a;hp=6d2c288096c6769c91ed663ab8ec854560992ba5;hpb=201c5026430f9bcc33f9db6a39f5d03db096c860;p=cpPlugins.git diff --git a/appli/bash/CMakeLists.txt b/appli/bash/CMakeLists.txt index 6d2c288..aa50398 100644 --- a/appli/bash/CMakeLists.txt +++ b/appli/bash/CMakeLists.txt @@ -1,27 +1,59 @@ -## ============================ -## == Configure source files == -## ============================ +SET(_pfx "cpPlugins_bash_") +SET(_src_dir ${CMAKE_CURRENT_SOURCE_DIR}) +SET(_bin_dir ${CMAKE_CURRENT_BINARY_DIR}) -FILE( - GLOB all_SOURCE_CXX_FILES RELATIVE - "${CMAKE_CURRENT_SOURCE_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx" - ) +## ======================== +## == Build sources list == +## ======================== + +FILE(GLOB _sources RELATIVE "${_src_dir}" "${_src_dir}/*.cxx") +FILE(GLOB _sources_cfg RELATIVE "${_src_dir}" "${_src_dir}/*.cxx.in") +FILE(GLOB _headers_cfg RELATIVE "${_src_dir}" "${_src_dir}/*.h.in") + +## ======================= +## == Configure sources == +## ======================= + +FOREACH(_cfg ${_headers_cfg}) + GET_FILENAME_COMPONENT(_ext ${_cfg} EXT) + STRING(LENGTH ${_ext} _ext_len) + STRING(SUBSTRING ${_ext} 1 ${_ext_len} _ext_name) + GET_FILENAME_COMPONENT(_real_ext ${_ext_name} NAME_WE) + GET_FILENAME_COMPONENT(_name ${_cfg} NAME_WE) + CONFIGURE_FILE( + ${_src_dir}/${_cfg} + ${_bin_dir}/${_name}.${_real_ext} @ONLY + ) +ENDFOREACH(_cfg) + +FOREACH(_cfg ${_sources_cfg}) + GET_FILENAME_COMPONENT(_ext ${_cfg} EXT) + STRING(LENGTH ${_ext} _ext_len) + STRING(SUBSTRING ${_ext} 1 ${_ext_len} _ext_name) + GET_FILENAME_COMPONENT(_real_ext ${_ext_name} NAME_WE) + GET_FILENAME_COMPONENT(_name ${_cfg} NAME_WE) + CONFIGURE_FILE( + ${_src_dir}/${_cfg} + ${_bin_dir}/${_name}.${_real_ext} @ONLY + ) + LIST(APPEND _sources ${_bin_dir}/${_name}.${_real_ext}) +ENDFOREACH(_cfg) ## ========================== ## == Compile source files == ## ========================== -FOREACH(source ${all_SOURCE_CXX_FILES}) - GET_FILENAME_COMPONENT(name ${source} NAME_WE) - ADD_EXECUTABLE(${name} ${source}) +FOREACH(_src ${_sources}) + GET_FILENAME_COMPONENT(_name ${_src} NAME_WE) + SET(_prog ${_pfx}${_name}) + ADD_EXECUTABLE(${_prog} ${_src}) INSTALL( - TARGETS ${name} + TARGETS ${_prog} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib/static ) - SET(${name}_APP ${name} CACHE INTERNAL "bash program ${name}") -ENDFOREACH(source) + SET(${_prog}_APP ${_prog} CACHE INTERNAL "bash program ${_prog}") +ENDFOREACH(_src) ## eof - $RCSfile$