Skip to content
Snippets Groups Projects
Commit 59d000f7 authored by Lars Bilke's avatar Lars Bilke
Browse files

[CMake] Search in Conan bin-dirs first for deps.

parent edf57e96
No related branches found
No related tags found
No related merge requests found
...@@ -3,26 +3,30 @@ macro(InstallDependencies TARGET) ...@@ -3,26 +3,30 @@ macro(InstallDependencies TARGET)
get_target_property(EXE_DIR ${TARGET} RUNTIME_OUTPUT_DIRECTORY) get_target_property(EXE_DIR ${TARGET} RUNTIME_OUTPUT_DIRECTORY)
set(TARGET_EXE ${EXE_DIR}/${TARGET}${CMAKE_EXECUTABLE_SUFFIX}) set(TARGET_EXE ${EXE_DIR}/${TARGET}${CMAKE_EXECUTABLE_SUFFIX})
if(EXISTS ${TARGET_EXE}) # Run CMake again after target was built to collect dependencies
# Run CMake again after target was built to collect dependencies add_custom_command(TARGET ${TARGET} POST_BUILD
add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} . -DPRE_INSTALL_RUN=ON
COMMAND ${CMAKE_COMMAND} . -DPRE_INSTALL_RUN=ON WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} )
)
if(EXISTS ${TARGET_EXE})
include(GetPrerequisites) include(GetPrerequisites)
# arg3: exclude system, arg4: recursive
if (VTK_BUILD_SHARED_LIBS) set(dirs ${CONAN_BIN_DIRS})
if(VTK_BUILD_SHARED_LIBS)
list(APPEND dirs ${vtkIOXML_RUNTIME_LIBRARY_DIRS}) list(APPEND dirs ${vtkIOXML_RUNTIME_LIBRARY_DIRS})
endif() endif()
list(APPEND dirs "/usr/local/lib;${CONAN_BIN_DIRS}") if(NOT WIN32)
get_prerequisites(${TARGET_EXE} TARGET_DEPENDENCIES ${EXCLUDE_SYSTEM} 1 "" ${dirs}) list(APPEND dirs "/usr/local/lib")
endif()
get_prerequisites(${TARGET_EXE} TARGET_DEPENDENCIES ${EXCLUDE_SYSTEM} 1 "" "${dirs}")
if(PRE_INSTALL_RUN) if(PRE_INSTALL_RUN)
message("-- Dependencies of target ${TARGET}:") message("-- Dependencies of target ${TARGET}:")
endif() endif()
foreach(DEPENDENCY ${TARGET_DEPENDENCIES}) foreach(DEPENDENCY ${TARGET_DEPENDENCIES})
if(NOT ${DEPENDENCY} MATCHES "@loader_path") if(NOT ${DEPENDENCY} MATCHES "@loader_path")
gp_resolve_item("${TARGET_EXE}" "${DEPENDENCY}" "" "" DEPENDENCY_PATH) gp_resolve_item("${TARGET_EXE}" "${DEPENDENCY}" "" "${dirs}" DEPENDENCY_PATH)
get_filename_component(RESOLVED_DEPENDENCY_PATH "${DEPENDENCY_PATH}" REALPATH) get_filename_component(RESOLVED_DEPENDENCY_PATH "${DEPENDENCY_PATH}" REALPATH)
string(TOLOWER ${DEPENDENCY} DEPENDENCY_LOWER) string(TOLOWER ${DEPENDENCY} DEPENDENCY_LOWER)
set(DEPENDENCY_PATHS ${DEPENDENCY_PATHS} ${RESOLVED_DEPENDENCY_PATH}) set(DEPENDENCY_PATHS ${DEPENDENCY_PATHS} ${RESOLVED_DEPENDENCY_PATH})
......
set(CMAKE_INSTALL_UCRT_LIBRARIES ON)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ON) set(CMAKE_INSTALL_OPENMP_LIBRARIES ON)
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR ZIP) set(CPACK_GENERATOR ZIP)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment