Skip to content

Commit

Permalink
Added an option to not install Doctest in CMake (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
nm17 authored and onqtam committed Oct 29, 2017
1 parent ffb7530 commit b63bf85
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions CMakeLists.txt
Expand Up @@ -9,6 +9,7 @@ project(doctest VERSION ${ver})

option(DOCTEST_WITH_TESTS "Build tests/examples" ON)
option(DOCTEST_WITH_MAIN_IN_STATIC_LIB "Build a static lib (cmake target) with a main entry point" ON)
option(DOCTEST_NO_INSTALL "Skip the installation process" OFF)

add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/doctest/>)
Expand Down Expand Up @@ -56,24 +57,26 @@ write_basic_package_version_file(

configure_file("scripts/cmake/Config.cmake.in" "${project_config}" @ONLY)

install(
TARGETS ${PROJECT_NAME}
EXPORT "${targets_export_name}"
INCLUDES DESTINATION "${include_install_dir}"
)

install(
FILES "doctest/doctest.h"
DESTINATION "${include_install_dir}"
)

install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)

install(
EXPORT "${targets_export_name}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)
if (${DOCTEST_NO_INSTALL})
install(
TARGETS ${PROJECT_NAME}
EXPORT "${targets_export_name}"
INCLUDES DESTINATION "${include_install_dir}"
)

install(
FILES "doctest/doctest.h"
DESTINATION "${include_install_dir}"
)

install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)

install(
EXPORT "${targets_export_name}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)
endif()

0 comments on commit b63bf85

Please sign in to comment.