diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index cb12222b8..13f81a731 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -1,7 +1,7 @@ target_include_directories(${SIMDJSON_LIB_NAME} - PUBLIC - ${PROJECT_SOURCE_DIR}/benchmark - ${PROJECT_SOURCE_DIR}/benchmark/linux + INTERFACE + $ + $ ) add_cpp_benchmark(parse) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dd96ee86a..3b3fd7b1e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,6 +3,7 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") # icc / icpc set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel") endif() +include(GNUInstallDirs) # we default on a shared library. if(SIMDJSON_BUILD_STATIC) @@ -26,11 +27,25 @@ set(SIMDJSON_SRC ) add_library(${SIMDJSON_LIB_NAME} ${SIMDJSON_LIB_TYPE} ${SIMDJSON_SRC}) + target_include_directories(${SIMDJSON_LIB_NAME} - PUBLIC ${PROJECT_SOURCE_DIR}/include + PUBLIC + $ + $ ) -install(TARGETS ${SIMDJSON_LIB_NAME} DESTINATION lib) +install(TARGETS ${SIMDJSON_LIB_NAME} + EXPORT ${SIMDJSON_LIB_NAME}-config + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +install(EXPORT ${SIMDJSON_LIB_NAME}-config + FILE ${SIMDJSON_LIB_NAME}-config.cmake + NAMESPACE ${SIMDJSON_LIB_NAME}:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${SIMDJSON_LIB_NAME} +) if(NOT MSVC) ## We output the library at the root of the current directory where cmake is invoked diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 86a89f9c0..219f8b406 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,7 @@ if(MSVC) -target_include_directories(${SIMDJSON_LIB_NAME} - PUBLIC ${PROJECT_SOURCE_DIR}/windows -) + target_include_directories(${SIMDJSON_LIB_NAME} + INTERFACE $ + ) endif() add_cpp_test(jsoncheck)