You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
graphengine/cmake/FindModule.cmake

30 lines
898 B

4 years ago
#[[
module - the name of export imported target
name - find the library name
path - find the library path
#]]
4 years ago
function(find_module module name)
4 years ago
if (TARGET ${module})
return()
endif()
4 years ago
set(options)
set(oneValueArgs)
set(multiValueArgs)
cmake_parse_arguments(MODULE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(path ${MODULE_UNPARSED_ARGUMENTS})
4 years ago
find_library(${module}_LIBRARY_DIR NAMES ${name} NAMES_PER_DIR PATHS ${path}
PATH_SUFFIXES lib
)
message(STATUS "find ${name} location ${${module}_LIBRARY_DIR}")
if ("${${module}_LIBRARY_DIR}" STREQUAL "${module}_LIBRARY_DIR-NOTFOUND")
message(FATAL_ERROR "${name} not found in ${path}")
endif()
4 years ago
add_library(${module} SHARED IMPORTED)
set_target_properties(${module} PROPERTIES
IMPORTED_LOCATION ${${module}_LIBRARY_DIR}
)
4 years ago
endfunction()