diff --git a/CMakeLists.txt b/CMakeLists.txt index e729a8b..c63edab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required(VERSION 3.9) project(csv) +include(GNUInstallDirs) + +find_path(HEDLEY_INCLUDE_DIRS "hedley.h") +find_package(mio CONFIG REQUIRED) +find_package(string-view-lite CONFIG REQUIRED) + if(CSV_CXX_STANDARD) set(CMAKE_CXX_STANDARD ${CSV_CXX_STANDARD}) else() @@ -38,16 +44,27 @@ set(CSV_TEST_DIR ${CMAKE_CURRENT_LIST_DIR}/tests) include_directories(${CSV_INCLUDE_DIR}) -## Load developer specific CMake settings -if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - SET(CSV_DEVELOPER TRUE) -endif() +SET(CSV_DEVELOPER OFF) ## Main Library add_subdirectory(${CSV_SOURCE_DIR}) -## Executables -add_subdirectory("programs") +install(TARGETS csv EXPORT unofficial-vincentlaucsb-csv-parser) + +install( + EXPORT unofficial-vincentlaucsb-csv-parser + FILE unofficial-vincentlaucsb-csv-parser-config.cmake + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/unofficial-vincentlaucsb-csv-parser" + NAMESPACE unofficial::vincentlaucsb-csv-parser:: +) + +install( + DIRECTORY "${CMAKE_SOURCE_DIR}/include/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/vincentlaucsb-csv-parser" + PATTERN "*.cpp" EXCLUDE + PATTERN "CMakeLists.txt" EXCLUDE + PATTERN "external" EXCLUDE +) ## Developer settings if (CSV_DEVELOPER) diff --git a/include/internal/CMakeLists.txt b/include/internal/CMakeLists.txt index 42cac24..30ea9e7 100644 --- a/include/internal/CMakeLists.txt +++ b/include/internal/CMakeLists.txt @@ -23,5 +23,9 @@ target_sources(csv data_type.h ) -set_target_properties(csv PROPERTIES LINKER_LANGUAGE CXX) -target_link_libraries(csv PRIVATE Threads::Threads) +set_target_properties(csv PROPERTIES LINKER_LANGUAGE CXX OUTPUT_NAME "vincentlaucsb-csv-parser-csv") +target_include_directories(csv + PUBLIC ${HEDLEY_INCLUDE_DIRS} + INTERFACE $ +) +target_link_libraries(csv PRIVATE Threads::Threads PUBLIC mio::mio mio::mio-headers nonstd::string-view-lite)