initial commit
Signed-off-by: Kamal Tufekcic <kamal@lo.sh>
This commit is contained in:
commit
d73755a275
165830 changed files with 568244 additions and 0 deletions
63
soliton_capi/cmake/SolitonConfig.cmake
Normal file
63
soliton_capi/cmake/SolitonConfig.cmake
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# Soliton CMake config — find_package(Soliton) support.
|
||||
#
|
||||
# Provides:
|
||||
# Soliton::Soliton — imported target (static or shared, depending on what's installed)
|
||||
# Soliton_FOUND — TRUE if found
|
||||
# Soliton_INCLUDE_DIR — path to soliton.h
|
||||
# Soliton_LIBRARY — path to libsoliton.a or libsoliton.so
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(Soliton_INCLUDE_DIR
|
||||
NAMES soliton.h
|
||||
HINTS
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
# Prefer static, fall back to shared.
|
||||
find_library(Soliton_LIBRARY
|
||||
NAMES soliton
|
||||
HINTS
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
find_package_handle_standard_args(Soliton
|
||||
REQUIRED_VARS Soliton_LIBRARY Soliton_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(Soliton_FOUND AND NOT TARGET Soliton::Soliton)
|
||||
# Detect whether the found library is static (.a) or shared (.so/.dylib).
|
||||
get_filename_component(_sol_ext "${Soliton_LIBRARY}" EXT)
|
||||
if(_sol_ext STREQUAL ".a" OR _sol_ext STREQUAL ".lib")
|
||||
set(_sol_type STATIC)
|
||||
else()
|
||||
set(_sol_type SHARED)
|
||||
endif()
|
||||
|
||||
add_library(Soliton::Soliton ${_sol_type} IMPORTED)
|
||||
set_target_properties(Soliton::Soliton PROPERTIES
|
||||
IMPORTED_LOCATION "${Soliton_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Soliton_INCLUDE_DIR}"
|
||||
)
|
||||
|
||||
# Static linking needs these system libs.
|
||||
if(_sol_type STREQUAL "STATIC")
|
||||
if(UNIX AND NOT APPLE)
|
||||
set_property(TARGET Soliton::Soliton APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES m dl pthread)
|
||||
elseif(APPLE)
|
||||
set_property(TARGET Soliton::Soliton APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES m dl pthread "-framework Security")
|
||||
elseif(WIN32)
|
||||
set_property(TARGET Soliton::Soliton APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ws2_32 userenv bcrypt ntdll)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_sol_type)
|
||||
unset(_sol_ext)
|
||||
endif()
|
||||
Loading…
Add table
Add a link
Reference in a new issue