diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index f1bc5dbd..d829787c 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -169,6 +169,13 @@ list (APPEND EXAMPLE_SOURCE_FILES tutorials/tutorial4.cpp ) +# programs listed here will not only be compiled, but also marked for +# installation +list (APPEND PROGRAM_SOURCE_FILES + examples/sim_2p_comp_reorder.cpp + examples/sim_2p_incomp.cpp + ) + # originally generated with the command: # find opm -name '*.h*' -a ! -name '*-pch.hpp' -printf '\t%p\n' | sort list (APPEND PUBLIC_HEADER_FILES diff --git a/cmake/Modules/OpmFiles.cmake b/cmake/Modules/OpmFiles.cmake index 40460c84..eda2598f 100644 --- a/cmake/Modules/OpmFiles.cmake +++ b/cmake/Modules/OpmFiles.cmake @@ -32,6 +32,7 @@ macro (opm_sources opm) set (TEST_SOURCE_FILES) set (TEST_DATA_FILES) set (PUBLIC_HEADER_FILES) + set (PROGRAM_SOURCE_FILES) # read the list of components from this file; it should set the above # lists (which are generic names) @@ -55,6 +56,9 @@ macro (opm_sources opm) foreach (_file IN LISTS EXAMPLE_SOURCE_FILES) list (APPEND examples_SOURCES ${PROJECT_SOURCE_DIR}/${_file}) endforeach (_file) + foreach (_file IN LISTS PROGRAM_SOURCE_FILES) + list (APPEND examples_SOURCES_DIST ${PROJECT_SOURCE_DIR}/${_file}) + endforeach (_file) # identify pre-compile header; if the project is called opm-foobar, # then it should be in opm/foobar/opm-foobar-pch.hpp diff --git a/cmake/Modules/OpmPackage.cmake b/cmake/Modules/OpmPackage.cmake index 1c6b9ab3..1e4c991c 100644 --- a/cmake/Modules/OpmPackage.cmake +++ b/cmake/Modules/OpmPackage.cmake @@ -93,9 +93,24 @@ macro (find_opm_package module deps header lib defs prog conf) set (_guess_bin_only "../${module}-build" "../${_module_lower}-build" - "../../${module}/build-cmake" - "../../${_module_lower}/build-cmake" ) + # try to figure out whether we are in a subdir build tree, and attempt + # to put the same name as the appropriate build tree for the module + get_filename_component (_build_dir "${CMAKE_CURRENT_BINARY_DIR}" NAME) + + # don't bother if we are in a project specific directory already + # (assuming no-one wants to name the build dir after another module!) + if ("${_build_dir}" STREQUAL "${PROJECT_NAME}") + set (_build_dir "") + endif ("${_build_dir}" STREQUAL "${PROJECT_NAME}") + + # look in similar dirs for the other module + list (APPEND _guess_bin_only + "../../${module}/${_build_dir}" + "../../${_module_lower}/${_build_dir}" + ) + + # generate items that are in the build, not source dir set (_guess_bin) foreach (_item IN ITEMS ${_guess} ${_guess_bin_only}) list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}") diff --git a/cmake/Modules/OpmSatellites.cmake b/cmake/Modules/OpmSatellites.cmake index fdc2b328..9b0d0c8f 100644 --- a/cmake/Modules/OpmSatellites.cmake +++ b/cmake/Modules/OpmSatellites.cmake @@ -95,6 +95,15 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp) ) endif (CMAKE_VERSION VERSION_LESS "2.8.4") endif(NOT "${test_regexp}" STREQUAL "") + + # if this program on the list of files that should be distributed? + # we check by the name of the source file + list (FIND ${satellite}_SOURCES_DIST "${_sat_FILE}" _is_util) + if (NOT (_is_util EQUAL -1)) + install (TARGETS ${_sat_NAME} RUNTIME + DESTINATION bin/ + ) + endif (NOT (_is_util EQUAL -1)) endforeach (_sat_FILE) endmacro (opm_compile_satellites opm prefix)