Commit 30fec201 authored by Martin Heistermann's avatar Martin Heistermann
Browse files

Make TinyAD finder target-based. Should be obsolete when TinyAD gains EXPORT-compatible CMake.

parent e811b6b1
Pipeline #20307 failed with stages
in 9 minutes and 50 seconds
......@@ -358,14 +358,6 @@ else ()
set (COMISO_CPLEX_CONFIG_FILE_SETTINGS "#define COMISO_CPLEX_AVAILABLE 0" )
endif ()
find_package (TINYAD)
if (TINYAD_FOUND)
set (COMISO_TINYAD_CONFIG_FILE_SETTINGS "#define COMISO_TINYAD_AVAILABLE 1" )
list( APPEND COMISO_INCLUDE_DIRECTORIES ${TINYAD_INCLUDE_DIRS} )
else()
set (COMISO_TINYAD_CONFIG_FILE_SETTINGS "#define COMISO_TINYAD_AVAILABLE 0" )
endif ()
set(TMP_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
set(CMAKE_FIND_LIBRARY_PREFIXES lib "") #Our lapack library is called liblapack.lib. Is there a better way to find it than this?
......@@ -467,6 +459,19 @@ else()
message (STATUS "OSQP not found!")
endif()
if (NOT TARGET TinyAD::TinyAD)
find_package (TINYAD)
endif()
if (TARGET TinyAD::TinyAD)
target_link_libraries(CoMISo PUBLIC TinyAD::TinyAD)
set (COMISO_TINYAD_CONFIG_FILE_SETTINGS "#define COMISO_TINYAD_AVAILABLE 1" )
message (STATUS "TinyAD found!")
else()
set (COMISO_TINYAD_CONFIG_FILE_SETTINGS "#define COMISO_TINYAD_AVAILABLE 0" )
message (STATUS "TinyAD not found!")
endif ()
target_include_directories(CoMISo
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
......
# - Try to find TINYAD
# Once done this will define
# TINYAD_FOUND - System has TINYAD
# TINYAD_INCLUDE_DIRS - The TINYAD include directories
set(TINYAD_DIR $ENV{TINYAD_DIR} CACHE PATH "TinyAD directory")
if (TINYAD_INCLUDE_DIR)
# in cache already
set(TINYAD_FOUND TRUE)
set(TINYAD_INCLUDE_DIRS "${TINYAD_INCLUDE_DIR}" )
else (TINYAD_INCLUDE_DIR)
# Check if the base path is set
if ( NOT CMAKE_WINDOWS_LIBS_DIR )
# This is the base directory for windows library search used in the finders we shipp.
set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
endif()
find_path( TINYAD_INCLUDE_DIR
find_path(TINYAD_INCLUDE_DIR
NAMES TinyAD/Scalar.hh
PATHS $ENV{TINYAD_DIR}
$ENV{TINYAD_DIR}/include
/usr/include
/usr/include
/usr/local/include
)
set(TINYAD_INCLUDE_DIRS "${TINYAD_INCLUDE_DIR}" )
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set TINYAD_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(TINYAD DEFAULT_MSG
TINYAD_INCLUDE_DIR)
find_package_handle_standard_args(TINYAD DEFAULT_MSG TINYAD_INCLUDE_DIR)
mark_as_advanced(TINYAD_INCLUDE_DIR)
endif(TINYAD_INCLUDE_DIR)
if(TINYAD_FOUND AND NOT TARGET TinyAD::TinyAD)
add_library(TinyAD::TinyAD INTERFACE IMPORTED)
target_include_directories(TinyAD::TinyAD INTERFACE ${TINYAD_INCLUDE_DIR})
endif()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment