diff --git a/CMakeLists.txt b/CMakeLists.txt index 82da81b2..cc80c309 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ project(Vector_BLF DESCRIPTION "Vector Binary Log File support library") # source code documentation -option(OPTION_RUN_DOXYGEN "Run Doxygen" ON) +option(OPTION_RUN_DOXYGEN "Run Doxygen" OFF) # static code analysis option(OPTION_RUN_CCCC "Run CCCC" OFF) @@ -21,6 +21,8 @@ option(OPTION_BUILD_TESTS "Build tests" OFF) option(OPTION_USE_GCOV "Build with gcov to generate coverage data on execution" OFF) option(OPTION_USE_GPROF "Build with gprof" OFF) option(OPTION_ADD_LCOV "Add lcov targets to generate HTML coverage report" OFF) +# Turn OFF, if you are using FetchContent to include it to your project +option(FETCH_CONTENT_INCLUSION "Include project with FetchContent_Declare in another project. In this case the headers and the cmake files are not needed, only the library" OFF) # directories include(GNUInstallDirs) diff --git a/src/Vector/BLF/CMakeLists.txt b/src/Vector/BLF/CMakeLists.txt index b028ea11..98b70acd 100644 --- a/src/Vector/BLF/CMakeLists.txt +++ b/src/Vector/BLF/CMakeLists.txt @@ -6,7 +6,7 @@ include(GenerateExportHeader) # targets -add_library(${PROJECT_NAME} SHARED "") +add_library(${PROJECT_NAME} STATIC "") # search paths include_directories( @@ -341,18 +341,25 @@ endif() # install install( - TARGETS ${PROJECT_NAME} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/vector_blf_export.h - ${CMAKE_CURRENT_BINARY_DIR}/config.h - $ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Vector/BLF) + TARGETS ${PROJECT_NAME}) + +if (NOT FETCH_CONTENT_INCLUSION) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/vector_blf_export.h + ${CMAKE_CURRENT_BINARY_DIR}/config.h + $ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Vector/BLF) +endif() # sub directories -add_subdirectory(docs) -add_subdirectory(tests) +if (OPTION_RUN_DOXYGEN) + add_subdirectory(docs) +endif() + +if (OPTION_BUILD_TESTS) + add_subdirectory(tests) +endif() diff --git a/src/Vector/BLF/ObjectHeaderBase.h b/src/Vector/BLF/ObjectHeaderBase.h index e73983cc..c167b935 100644 --- a/src/Vector/BLF/ObjectHeaderBase.h +++ b/src/Vector/BLF/ObjectHeaderBase.h @@ -8,6 +8,8 @@ #include +#include + #include #include diff --git a/src/Vector/BLF/platform.h b/src/Vector/BLF/platform.h index 3b07b24d..c5844c05 100644 --- a/src/Vector/BLF/platform.h +++ b/src/Vector/BLF/platform.h @@ -9,6 +9,7 @@ #pragma once #include +#include /* GCC */ #ifdef __GNUC__ diff --git a/src/Vector/CMakeLists.txt b/src/Vector/CMakeLists.txt index d321b47d..e3cca81e 100644 --- a/src/Vector/CMakeLists.txt +++ b/src/Vector/CMakeLists.txt @@ -4,6 +4,8 @@ add_subdirectory(BLF) -install( - FILES BLF.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Vector) +if (NOT FETCH_CONTENT_INCLUSION) + install( + FILES BLF.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Vector) +endif()