mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Fixup installation
This commit is contained in:
parent
ebeeaaeec6
commit
add7068f21
288
CMakeLists.txt
288
CMakeLists.txt
@ -9,6 +9,11 @@ endif()
|
|||||||
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
|
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
|
||||||
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
|
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
|
||||||
option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
|
option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
|
||||||
|
option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
|
||||||
|
option(CATCH_INSTALL_EXTRAS "Install extras alongside library" ON)
|
||||||
|
|
||||||
|
|
||||||
|
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
|
||||||
|
|
||||||
|
|
||||||
# Catch2's build breaks if done in-tree. You probably should not build
|
# Catch2's build breaks if done in-tree. You probably should not build
|
||||||
@ -58,8 +63,6 @@ endif()
|
|||||||
#option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
|
#option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
|
||||||
#option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
|
#option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
|
||||||
#option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
|
#option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
|
||||||
#option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
|
|
||||||
#option(CATCH_INSTALL_EXTRAS "Install extras alongside library" ON)
|
|
||||||
#
|
#
|
||||||
#set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
#set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
#
|
#
|
||||||
@ -67,185 +70,108 @@ endif()
|
|||||||
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
|
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
|
||||||
#endif()
|
#endif()
|
||||||
#
|
#
|
||||||
#if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
|
|
||||||
# find_package(PythonInterp)
|
|
||||||
# if (NOT PYTHONINTERP_FOUND)
|
|
||||||
# message(FATAL_ERROR "Python not found, but required for tests")
|
|
||||||
# endif()
|
|
||||||
# add_subdirectory(projects)
|
|
||||||
#endif()
|
|
||||||
#
|
|
||||||
#if(CATCH_BUILD_EXTRA_TESTS)
|
|
||||||
# add_subdirectory(projects/ExtraTests)
|
|
||||||
#endif()
|
|
||||||
#
|
|
||||||
## add catch as a 'linkable' target
|
|
||||||
#add_library(Catch2 INTERFACE)
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
## depend on some obvious c++11 features so the dependency is transitively added dependents
|
# Only perform the installation steps when Catch is not being used as
|
||||||
#target_compile_features(Catch2
|
# a subproject via `add_subdirectory`, or the destinations will break,
|
||||||
# INTERFACE
|
# see https://github.com/catchorg/Catch2/issues/1373
|
||||||
# cxx_alignas
|
if (NOT_SUBPROJECT)
|
||||||
# cxx_alignof
|
|
||||||
# cxx_attributes
|
configure_package_config_file(
|
||||||
# cxx_auto_type
|
${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in
|
||||||
# cxx_constexpr
|
${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake
|
||||||
# cxx_defaulted_functions
|
INSTALL_DESTINATION
|
||||||
# cxx_deleted_functions
|
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||||
# cxx_final
|
)
|
||||||
# cxx_lambdas
|
|
||||||
# cxx_noexcept
|
## TODO: Catch2 main target?
|
||||||
# cxx_override
|
## Install some cpp file as well?
|
||||||
# cxx_range_for
|
|
||||||
# cxx_rvalue_references
|
# By default, FooConfigVersion is tied to architecture that it was
|
||||||
# cxx_static_assert
|
# generated on. Because Catch2 is header-only, it is arch-independent
|
||||||
# cxx_strong_enums
|
# and thus Catch2ConfigVersion should not be tied to the architecture
|
||||||
# cxx_trailing_return_types
|
# it was generated on.
|
||||||
# cxx_unicode_literals
|
#
|
||||||
# cxx_user_literals
|
# CMake does not provide a direct customization point for this in
|
||||||
# cxx_variadic_macros
|
# `write_basic_package_version_file`, but it can be accomplished
|
||||||
#)
|
# indirectly by temporarily redefining `CMAKE_SIZEOF_VOID_P` to an
|
||||||
#
|
# empty string. Note that just undefining the variable could be
|
||||||
#target_include_directories(Catch2
|
# insufficient in cases where the variable was already in CMake cache
|
||||||
# INTERFACE
|
set(CATCH2_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
|
||||||
# $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/single_include>
|
set(CMAKE_SIZEOF_VOID_P "")
|
||||||
# $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
write_basic_package_version_file(
|
||||||
#)
|
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
||||||
#
|
COMPATIBILITY
|
||||||
#if (ANDROID)
|
SameMajorVersion
|
||||||
# target_link_libraries(Catch2 INTERFACE log)
|
)
|
||||||
#endif()
|
set(CMAKE_SIZEOF_VOID_P ${CATCH2_CMAKE_SIZEOF_VOID_P})
|
||||||
#
|
|
||||||
## provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
|
install(
|
||||||
#add_library(Catch2::Catch2 ALIAS Catch2)
|
FILES
|
||||||
#
|
"${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake"
|
||||||
## Only perform the installation steps when Catch is not being used as
|
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
||||||
## a subproject via `add_subdirectory`, or the destinations will break,
|
DESTINATION
|
||||||
## see https://github.com/catchorg/Catch2/issues/1373
|
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||||
#if (NOT_SUBPROJECT)
|
)
|
||||||
# set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
|
|
||||||
#
|
# Install documentation
|
||||||
# configure_package_config_file(
|
if(CATCH_INSTALL_DOCS)
|
||||||
# ${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in
|
install(
|
||||||
# ${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake
|
DIRECTORY
|
||||||
# INSTALL_DESTINATION
|
docs/
|
||||||
# ${CATCH_CMAKE_CONFIG_DESTINATION}
|
DESTINATION
|
||||||
# )
|
"${CMAKE_INSTALL_DOCDIR}"
|
||||||
#
|
)
|
||||||
#
|
endif()
|
||||||
# # create and install an export set for catch target as Catch2::Catch
|
|
||||||
# install(
|
if(CATCH_INSTALL_HELPERS)
|
||||||
# TARGETS
|
# Install CMake scripts
|
||||||
# Catch2
|
install(
|
||||||
# EXPORT
|
FILES
|
||||||
# Catch2Targets
|
"extras/ParseAndAddCatchTests.cmake"
|
||||||
# DESTINATION
|
"extras/Catch.cmake"
|
||||||
# ${CMAKE_INSTALL_LIBDIR}
|
"extras/CatchAddTests.cmake"
|
||||||
# )
|
DESTINATION
|
||||||
#
|
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||||
#
|
)
|
||||||
# install(
|
|
||||||
# EXPORT
|
# Install debugger helpers
|
||||||
# Catch2Targets
|
install(
|
||||||
# NAMESPACE
|
FILES
|
||||||
# Catch2::
|
"extras/gdbinit"
|
||||||
# DESTINATION
|
"extras/lldbinit"
|
||||||
# ${CATCH_CMAKE_CONFIG_DESTINATION}
|
DESTINATION
|
||||||
# )
|
${CMAKE_INSTALL_DATAROOTDIR}/Catch2
|
||||||
#
|
)
|
||||||
# # By default, FooConfigVersion is tied to architecture that it was
|
endif()
|
||||||
# # generated on. Because Catch2 is header-only, it is arch-independent
|
|
||||||
# # and thus Catch2ConfigVersion should not be tied to the architecture
|
## Provide some pkg-config integration
|
||||||
# # it was generated on.
|
set(PKGCONFIG_INSTALL_DIR
|
||||||
# #
|
"${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
|
||||||
# # CMake does not provide a direct customization point for this in
|
CACHE PATH "Path where catch2.pc is installed"
|
||||||
# # `write_basic_package_version_file`, but it can be accomplished
|
)
|
||||||
# # indirectly by temporarily redefining `CMAKE_SIZEOF_VOID_P` to an
|
configure_file(
|
||||||
# # empty string. Note that just undefining the variable could be
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in
|
||||||
# # insufficient in cases where the variable was already in CMake cache
|
${CMAKE_CURRENT_BINARY_DIR}/catch2.pc
|
||||||
# set(CATCH2_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
|
@ONLY
|
||||||
# set(CMAKE_SIZEOF_VOID_P "")
|
)
|
||||||
# write_basic_package_version_file(
|
install(
|
||||||
# "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
FILES
|
||||||
# COMPATIBILITY
|
"${CMAKE_CURRENT_BINARY_DIR}/catch2.pc"
|
||||||
# SameMajorVersion
|
DESTINATION
|
||||||
# )
|
${PKGCONFIG_INSTALL_DIR}
|
||||||
# set(CMAKE_SIZEOF_VOID_P ${CATCH2_CMAKE_SIZEOF_VOID_P})
|
)
|
||||||
#
|
|
||||||
# install(
|
# CPack/CMake started taking the package version from project version 3.12
|
||||||
# DIRECTORY
|
# So we need to set the version manually for older CMake versions
|
||||||
# "single_include/"
|
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
|
||||||
# DESTINATION
|
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
||||||
# "${CMAKE_INSTALL_INCLUDEDIR}"
|
endif()
|
||||||
# )
|
|
||||||
#
|
set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/")
|
||||||
# install(
|
|
||||||
# FILES
|
|
||||||
# "${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake"
|
include( CPack )
|
||||||
# "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
|
||||||
# DESTINATION
|
endif(NOT_SUBPROJECT)
|
||||||
# ${CATCH_CMAKE_CONFIG_DESTINATION}
|
|
||||||
# )
|
|
||||||
#
|
|
||||||
# # Install documentation
|
|
||||||
# if(CATCH_INSTALL_DOCS)
|
|
||||||
# install(
|
|
||||||
# DIRECTORY
|
|
||||||
# docs/
|
|
||||||
# DESTINATION
|
|
||||||
# "${CMAKE_INSTALL_DOCDIR}"
|
|
||||||
# )
|
|
||||||
# endif()
|
|
||||||
#
|
|
||||||
# if(CATCH_INSTALL_HELPERS)
|
|
||||||
# # Install CMake scripts
|
|
||||||
# install(
|
|
||||||
# FILES
|
|
||||||
# "extras/ParseAndAddCatchTests.cmake"
|
|
||||||
# "extras/Catch.cmake"
|
|
||||||
# "extras/CatchAddTests.cmake"
|
|
||||||
# DESTINATION
|
|
||||||
# ${CATCH_CMAKE_CONFIG_DESTINATION}
|
|
||||||
# )
|
|
||||||
#
|
|
||||||
# # Install debugger helpers
|
|
||||||
# install(
|
|
||||||
# FILES
|
|
||||||
# "extras/gdbinit"
|
|
||||||
# "extras/lldbinit"
|
|
||||||
# DESTINATION
|
|
||||||
# ${CMAKE_INSTALL_DATAROOTDIR}/Catch2
|
|
||||||
# )
|
|
||||||
# endif()
|
|
||||||
#
|
|
||||||
# ## Provide some pkg-config integration
|
|
||||||
# set(PKGCONFIG_INSTALL_DIR
|
|
||||||
# "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
|
|
||||||
# CACHE PATH "Path where catch2.pc is installed"
|
|
||||||
# )
|
|
||||||
# configure_file(
|
|
||||||
# ${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in
|
|
||||||
# ${CMAKE_CURRENT_BINARY_DIR}/catch2.pc
|
|
||||||
# @ONLY
|
|
||||||
# )
|
|
||||||
# install(
|
|
||||||
# FILES
|
|
||||||
# "${CMAKE_CURRENT_BINARY_DIR}/catch2.pc"
|
|
||||||
# DESTINATION
|
|
||||||
# ${PKGCONFIG_INSTALL_DIR}
|
|
||||||
# )
|
|
||||||
#
|
|
||||||
# # CPack/CMake started taking the package version from project version 3.12
|
|
||||||
# # So we need to set the version manually for older CMake versions
|
|
||||||
# if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
|
|
||||||
# set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
|
||||||
# endif()
|
|
||||||
#
|
|
||||||
# set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/")
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# include( CPack )
|
|
||||||
#
|
|
||||||
#endif(NOT_SUBPROJECT)
|
|
||||||
|
@ -29,6 +29,7 @@ set(BENCHMARK_SOURCES
|
|||||||
SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES})
|
SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES})
|
||||||
|
|
||||||
set(INTERNAL_HEADERS
|
set(INTERNAL_HEADERS
|
||||||
|
${SOURCES_DIR}/catch.hpp
|
||||||
${SOURCES_DIR}/catch_approx.h
|
${SOURCES_DIR}/catch_approx.h
|
||||||
${SOURCES_DIR}/catch_assertionhandler.h
|
${SOURCES_DIR}/catch_assertionhandler.h
|
||||||
${SOURCES_DIR}/catch_assertioninfo.h
|
${SOURCES_DIR}/catch_assertioninfo.h
|
||||||
@ -224,12 +225,69 @@ add_library(Catch2 STATIC
|
|||||||
${BENCHMARK_SOURCES}
|
${BENCHMARK_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
|
||||||
|
add_library(Catch2::Catch2 ALIAS Catch2)
|
||||||
|
if (ANDROID)
|
||||||
|
target_link_libraries(Catch2 INTERFACE log)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
target_include_directories(Catch2
|
target_include_directories(Catch2
|
||||||
PUBLIC
|
PUBLIC
|
||||||
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
|
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# depend on bunch of C++11 and C++14 features to have C++14 enabled by default
|
||||||
|
target_compile_features(Catch2
|
||||||
|
INTERFACE
|
||||||
|
cxx_alignas
|
||||||
|
cxx_alignof
|
||||||
|
cxx_attributes
|
||||||
|
cxx_auto_type
|
||||||
|
cxx_constexpr
|
||||||
|
cxx_defaulted_functions
|
||||||
|
cxx_deleted_functions
|
||||||
|
cxx_final
|
||||||
|
cxx_lambdas
|
||||||
|
cxx_noexcept
|
||||||
|
cxx_override
|
||||||
|
cxx_range_for
|
||||||
|
cxx_rvalue_references
|
||||||
|
cxx_static_assert
|
||||||
|
cxx_strong_enums
|
||||||
|
cxx_trailing_return_types
|
||||||
|
cxx_unicode_literals
|
||||||
|
cxx_user_literals
|
||||||
|
cxx_variable_templates
|
||||||
|
cxx_variadic_macros
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NOT_SUBPROJECT)
|
||||||
|
# create and install an export set for catch target as Catch2::Catch
|
||||||
|
install(
|
||||||
|
TARGETS
|
||||||
|
Catch2
|
||||||
|
EXPORT
|
||||||
|
Catch2Targets
|
||||||
|
DESTINATION
|
||||||
|
${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
install(
|
||||||
|
EXPORT
|
||||||
|
Catch2Targets
|
||||||
|
NAMESPACE
|
||||||
|
Catch2::
|
||||||
|
DESTINATION
|
||||||
|
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||||
|
)
|
||||||
|
# This installs the headers
|
||||||
|
install(DIRECTORY ${SOURCES_DIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h*")
|
||||||
|
# TODO: Also install the helper main
|
||||||
|
endif()
|
||||||
|
|
||||||
# Some tests require a full recompilation of Catch2 lib with different
|
# Some tests require a full recompilation of Catch2 lib with different
|
||||||
# compilation flags. They can link against this target to recompile all
|
# compilation flags. They can link against this target to recompile all
|
||||||
# the sources into the binary.
|
# the sources into the binary.
|
||||||
|
Loading…
Reference in New Issue
Block a user