mirror of
https://github.com/red0124/ssp.git
synced 2025-01-23 04:55:20 +01:00
Update CMake files
This commit is contained in:
parent
0e28a06799
commit
db2a72c18b
@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
project(
|
||||
ssp
|
||||
VERSION 0.0.1
|
||||
DESCRIPTION "Static split parser"
|
||||
VERSION 1.3.0
|
||||
DESCRIPTION "csv parser"
|
||||
HOMEPAGE_URL "https://github.com/red0124/ssp"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
@ -11,22 +11,23 @@ project(
|
||||
# ---- Warning guard ----
|
||||
|
||||
# Protect dependents from this project's warnings if the guard isn't disabled
|
||||
set(ssp_warning_guard SYSTEM)
|
||||
if(ssp_INCLUDE_WITHOUT_SYSTEM)
|
||||
set(ssp_warning_guard "")
|
||||
set(SSP_WARNING_GUARD SYSTEM)
|
||||
if(SSP_INCLUDE_WITHOUT_SYSTEM)
|
||||
set(SSP_WARNING_GUARD "")
|
||||
endif()
|
||||
|
||||
# ---- Dependencies ----
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
fetchcontent_declare(
|
||||
fast_float
|
||||
GIT_REPOSITORY https://github.com/red0124/fast_float.git
|
||||
GIT_TAG origin/meson
|
||||
GIT_SHALLOW TRUE)
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(fast_float)
|
||||
set(fast_float_source_dir "${FETCHCONTENT_BASE_DIR}/fast_float-src")
|
||||
fetchcontent_makeavailable(fast_float)
|
||||
set(FAST_FLOAT_SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/fast_float-src")
|
||||
|
||||
# ---- Declare library ----
|
||||
|
||||
@ -35,7 +36,7 @@ add_library(ssp::ssp ALIAS ssp)
|
||||
|
||||
target_include_directories(
|
||||
ssp
|
||||
${ssp_warning_guard}
|
||||
${SSP_WARNING_GUARD}
|
||||
INTERFACE
|
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/fast_float>"
|
||||
@ -55,19 +56,21 @@ target_link_libraries(
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(ssp_directory "ssp-${PROJECT_VERSION}")
|
||||
set(ssp_include_directory "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(SSP_DIRECTORY "ssp-${PROJECT_VERSION}")
|
||||
set(SSP_INCLUDE_DIRECTORY "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
install(
|
||||
DIRECTORY "${PROJECT_SOURCE_DIR}/include/" "${fast_float_source_dir}/include/"
|
||||
DESTINATION "${ssp_include_directory}"
|
||||
DIRECTORY
|
||||
"${PROJECT_SOURCE_DIR}/include/"
|
||||
"${FAST_FLOAT_SOURCE_DIR}/include/"
|
||||
DESTINATION "${SSP_INCLUDE_DIRECTORY}"
|
||||
COMPONENT ssp_Development
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS ssp
|
||||
EXPORT sspTargets
|
||||
INCLUDES DESTINATION "${ssp_include_directory}"
|
||||
INCLUDES DESTINATION "${SSP_INCLUDE_DIRECTORY}"
|
||||
)
|
||||
|
||||
write_basic_package_version_file(
|
||||
@ -76,11 +79,11 @@ write_basic_package_version_file(
|
||||
ARCH_INDEPENDENT
|
||||
)
|
||||
|
||||
set(ssp_install_cmakedir "${CMAKE_INSTALL_LIBDIR}/cmake/${ssp_directory}")
|
||||
set(SSP_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${SSP_DIRECTORY}")
|
||||
|
||||
install(
|
||||
FILES "${PROJECT_BINARY_DIR}/ssp-config-version.cmake"
|
||||
DESTINATION "${ssp_install_cmakedir}"
|
||||
DESTINATION "${SSP_INSTALL_CMAKEDIR}"
|
||||
COMPONENT ssp_Development
|
||||
)
|
||||
|
||||
@ -88,7 +91,7 @@ install(
|
||||
EXPORT sspTargets
|
||||
FILE ssp-config.cmake
|
||||
NAMESPACE ssp::
|
||||
DESTINATION "${ssp_install_cmakedir}"
|
||||
DESTINATION "${SSP_INSTALL_CMAKEDIR}"
|
||||
COMPONENT ssp_Development
|
||||
)
|
||||
|
||||
|
@ -4,17 +4,14 @@ project(ssp_tests CXX)
|
||||
|
||||
# ---- Dependencies ----
|
||||
|
||||
set(
|
||||
ssp_INCLUDE_WITHOUT_SYSTEM
|
||||
YES
|
||||
CACHE
|
||||
INTERNAL
|
||||
set(SSP_INCLUDE_WITHOUT_SYSTEM YES
|
||||
CACHE INTERNAL
|
||||
"Turn the warning guard off to have errors appear in test builds"
|
||||
)
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(ssp SOURCE_DIR "${PROJECT_SOURCE_DIR}/..")
|
||||
FetchContent_MakeAvailable(ssp)
|
||||
fetchcontent_declare(ssp SOURCE_DIR "${PROJECT_SOURCE_DIR}/..")
|
||||
fetchcontent_makeavailable(ssp)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_compile_options(ssp INTERFACE -Wall -Wextra)
|
||||
@ -30,8 +27,13 @@ enable_testing()
|
||||
|
||||
foreach(name IN ITEMS test_splitter test_parser test_converter test_extractions)
|
||||
add_executable("${name}" "${name}.cpp")
|
||||
target_link_libraries("${name}" PRIVATE ssp::ssp fast_float doctest::doctest)
|
||||
target_compile_definitions("${name}" PRIVATE
|
||||
DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN CMAKE_GITHUB_CI)
|
||||
target_link_libraries(
|
||||
"${name}"
|
||||
PRIVATE ssp::ssp fast_float doctest::doctest
|
||||
)
|
||||
target_compile_definitions(
|
||||
"${name}"
|
||||
PRIVATE DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN CMAKE_GITHUB_CI
|
||||
)
|
||||
doctest_discover_tests("${name}")
|
||||
endforeach()
|
||||
|
Loading…
Reference in New Issue
Block a user