mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-03 01:56:13 +01:00
[WIP] better FindTREXIO module (following FindSDL2 example)
This commit is contained in:
parent
6f499ea58d
commit
f389ba2952
@ -1,45 +1,77 @@
|
||||
|
||||
|
||||
#===========================================
|
||||
|
||||
# Try to find TREXIO library;
|
||||
# If found, it will define the following variables (note the plural form):
|
||||
# TREXIO_FOUND - System has libtrexio;
|
||||
# TREXIO_INCLUDE_DIRS - The TREXIO include directories;
|
||||
# TREXIO_LIBRARIES - The libraries needed to use TREXIO;
|
||||
|
||||
# If TREXIO has been installed in a non-standard location, one can set an
|
||||
# environment variable $TREXIO_DIR in the current shell:
|
||||
# $ export TREXIO_DIR=<custom_path>
|
||||
# to indicate the prefix used during the TREXIO installation
|
||||
# (typically `./configure prefix=<custom_path> ..` or `cmake -DCMAKE_INSTALL_DIR=<custom_path> ..`)
|
||||
|
||||
# This file should be located WITHIN your project source tree.
|
||||
# (e.g. in cmake/FindTREXIO.cmake file)
|
||||
# (e.g. in cmake/FindTREXIO.cmake)
|
||||
# How to use it in your project CMakeLists.txt:
|
||||
|
||||
# This is needed to locate FindTREXIO.cmake file, modify it according to your source tree.
|
||||
# list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
|
||||
# usage in CMakeLists.txt
|
||||
#list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
# find_package(TREXIO)
|
||||
#include_directories("${TREXIO_INCLUDE_DIR}")
|
||||
#target_link_libraries(your_target ${TREXIO_LIBRARY})
|
||||
# if (TREXIO_FOUND)
|
||||
# include_directories(${TREXIO_INCLUDE_DIRS})
|
||||
# target_link_libraries(your_target ${TREXIO_LIBRARIES})
|
||||
# endif()
|
||||
|
||||
#===========================================
|
||||
|
||||
# If already in cache, be silent
|
||||
if (TREXIO_INCLUDE_DIR AND TREXIO_LIBRARY)
|
||||
set(TREXIO_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
# This file is distirbuted under the BSD 3-Clause License.
|
||||
# Copyright (c) 2021, TREX Center of Excellence
|
||||
|
||||
set(TREXIO_FOUND OFF)
|
||||
set(TREXIO_LIBRARY)
|
||||
#===========================================
|
||||
|
||||
set(TREXIO_NAMES "libtrexio.so")
|
||||
#set(TREXIO_NAMES "libtrexio.so" "libtrexio.dylib" "libtrexio.la")
|
||||
message("<FindTREXIO.cmake>")
|
||||
|
||||
set(TREXIO_SEARCH_PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
find_path(TREXIO_INCLUDE_DIR
|
||||
NAMES trexio.h
|
||||
HINTS /usr/include
|
||||
/usr/local/include
|
||||
$ENV{HOME}/include)
|
||||
HINTS $ENV{TREXIO_DIR}
|
||||
PATH_SUFFIXES include/trexio include
|
||||
PATHS ${TREXIO_SEARCH_PATHS}
|
||||
)
|
||||
|
||||
|
||||
# No need to specify platform-specific prefix (e.g. libtrexio on Unix) or
|
||||
# suffix (e.g. .so on Unix or .dylib on MacOS) in NAMES. CMake takes care of that.
|
||||
find_library(TREXIO_LIBRARY
|
||||
NAMES ${TREXIO_NAMES}
|
||||
PATHS /usr/lib
|
||||
/usr/local/lib
|
||||
$ENV{HOME}/lib
|
||||
NO_DEFAULT_PATH)
|
||||
NAMES trexio
|
||||
HINTS $ENV{TREXIO_DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${TREXIO_SEARCH_PATHS}
|
||||
)
|
||||
|
||||
message("<FindTREXIO.cmake>")
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set TREXIO_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TREXIO DEFAULT_MSG TREXIO_LIBRARY TREXIO_INCLUDE_DIR )
|
||||
MARK_AS_ADVANCED(TREXIO_INCLUDE_DIR TREXIO_LIBRARY)
|
||||
|
||||
# Mot setting _INCLUDE_DIR and _LIBRARIES is considered a bug,
|
||||
# see https://gitlab.kitware.com/cmake/community/-/wikis/doc/tutorials/How-To-Find-Libraries
|
||||
set(TREXIO_LIBRARIES ${TREXIO_LIBRARY})
|
||||
set(TREXIO_INCLUDE_DIRS ${TREXIO_INCLUDE_DIR})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user