2019-04-21 11:22:48 +02:00
|
|
|
option(FORT_HAVE_WCHAR "Enable wchar support" ON)
|
2019-08-29 08:12:58 +02:00
|
|
|
option(FORT_HAVE_UTF8 "Enable UTF8 support" ON)
|
2019-04-21 11:22:48 +02:00
|
|
|
|
|
|
|
add_library(fort
|
|
|
|
fort.c)
|
|
|
|
|
|
|
|
target_include_directories(fort
|
|
|
|
PUBLIC
|
2020-02-09 11:02:25 +01:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
2019-04-21 11:22:48 +02:00
|
|
|
)
|
|
|
|
|
2019-05-22 21:42:52 +02:00
|
|
|
set_target_properties(fort
|
2019-05-26 09:13:58 +02:00
|
|
|
PROPERTIES VERSION ${libfort_VERSION}
|
|
|
|
SOVERSION ${libfort_SOVERSION})
|
2019-05-22 21:42:52 +02:00
|
|
|
|
2019-08-29 08:12:58 +02:00
|
|
|
if(NOT FORT_HAVE_WCHAR)
|
2019-04-21 11:22:48 +02:00
|
|
|
target_compile_definitions(fort
|
|
|
|
PRIVATE
|
2019-08-29 08:12:58 +02:00
|
|
|
-DFT_CONGIG_DISABLE_WCHAR
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT FORT_HAVE_UTF8)
|
|
|
|
target_compile_definitions(fort
|
|
|
|
PRIVATE
|
|
|
|
-DFT_CONGIG_DISABLE_UTF8
|
2019-04-21 11:22:48 +02:00
|
|
|
)
|
|
|
|
endif()
|
2019-05-22 22:20:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
install(
|
2020-02-09 11:02:25 +01:00
|
|
|
TARGETS fort
|
2020-02-10 21:00:47 +01:00
|
|
|
EXPORT ${PROJECT_NAME}-targets
|
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
2019-05-22 22:20:33 +02:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
)
|
2020-02-09 11:02:25 +01:00
|
|
|
install(
|
|
|
|
FILES fort.h fort.hpp
|
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
|
|
)
|
2019-05-26 09:13:58 +02:00
|
|
|
|
|
|
|
configure_file(libfort.pc.in libfort.pc @ONLY)
|
2020-02-09 11:02:25 +01:00
|
|
|
install(
|
|
|
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/libfort.pc
|
|
|
|
DESTINATION lib/pkgconfig
|
|
|
|
)
|
|
|
|
|
2020-02-10 21:00:47 +01:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
configure_package_config_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../cmake/${PROJECT_NAME}-config.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
|
|
|
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
|
|
|
)
|
|
|
|
write_basic_package_version_file(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
|
|
|
|
COMPATIBILITY SameMajorVersion
|
|
|
|
)
|
2020-02-09 11:02:25 +01:00
|
|
|
install(
|
2020-02-10 21:00:47 +01:00
|
|
|
FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
|
2020-02-09 11:02:25 +01:00
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
|
|
|
)
|
2020-02-10 21:00:47 +01:00
|
|
|
|
|
|
|
install(
|
|
|
|
EXPORT ${PROJECT_NAME}-targets
|
|
|
|
FILE ${PROJECT_NAME}-targets.cmake
|
|
|
|
NAMESPACE ${PROJECT_NAME}::
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
|
|
|
|
)
|
|
|
|
|