From 19ecad6f68154df2ba182c93224bdda8d7527b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 3 May 2020 18:54:38 +0200 Subject: [PATCH] Rename CMake/pkg-config target Catch2Main to Catch2WithMain This describes the reality better, as it also links in the rest of Catch2. The on-disk name of the static library remains just `Catch2Main`, as that is what it is -- single main function -- and on-disk artifacts cannot describe link dependencies. --- .../{catch2-main.pc.in => catch2-with-main.pc.in} | 6 +++--- CMake/catch2.pc.in | 2 +- CMakeLists.txt | 6 +++--- conanfile.py | 2 +- examples/CMakeLists.txt | 2 +- src/CMakeLists.txt | 15 +++++++++------ 6 files changed, 18 insertions(+), 15 deletions(-) rename CMake/{catch2-main.pc.in => catch2-with-main.pc.in} (55%) diff --git a/CMake/catch2-main.pc.in b/CMake/catch2-with-main.pc.in similarity index 55% rename from CMake/catch2-main.pc.in rename to CMake/catch2-with-main.pc.in index 4189cc77..122f1f96 100644 --- a/CMake/catch2-main.pc.in +++ b/CMake/catch2-with-main.pc.in @@ -2,9 +2,9 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ pkg_version=@Catch2_VERSION@ -Name: Catch2-Main -Description: Links in the default main function for Catch2 +Name: Catch2-With-Main +Description: A modern, C++-native test framework for C++14 and above (links in default main) Version: ${pkg_version} Requires: catch2 = ${pkg_version} Cflags: -I${includedir} -Libs: -L${libdir} -lCatch2Main +Libs: -L${libdir} -lCatch2WithMain diff --git a/CMake/catch2.pc.in b/CMake/catch2.pc.in index 183114b6..c37eb8ad 100644 --- a/CMake/catch2.pc.in +++ b/CMake/catch2.pc.in @@ -2,7 +2,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ Name: Catch2 -Description: A modern, C++-native, header-only, test framework for C++14 and above +Description: A modern, C++-native, test framework for C++14 and above URL: https://github.com/catchorg/Catch2 Version: @Catch2_VERSION@ Cflags: -I${includedir} diff --git a/CMakeLists.txt b/CMakeLists.txt index e1359824..ad069449 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,14 +166,14 @@ if (NOT_SUBPROJECT) @ONLY ) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2-main.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/catch2-main.pc + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2-with-main.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/catch2-with-main.pc @ONLY ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/catch2.pc" - "${CMAKE_CURRENT_BINARY_DIR}/catch2-main.pc" + "${CMAKE_CURRENT_BINARY_DIR}/catch2-with-main.pc" DESTINATION ${PKGCONFIG_INSTALL_DIR} ) diff --git a/conanfile.py b/conanfile.py index 3a1bf224..1379f8c4 100644 --- a/conanfile.py +++ b/conanfile.py @@ -40,6 +40,6 @@ class CatchConan(ConanFile): def package_info(self): self.cpp_info.libs = [ - 'Catch2Main', 'Catch2'] if self.options.with_main else ['Catch2'] + 'Catch2WithMain', 'Catch2'] if self.options.with_main else ['Catch2'] self.cpp_info.names["cmake_find_package"] = "Catch2" self.cpp_info.names["cmake_find_package_multi"] = "Catch2" diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d7c6fe93..af34d437 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -52,7 +52,7 @@ set(ALL_EXAMPLE_TARGETS ) foreach( name ${ALL_EXAMPLE_TARGETS} ) - target_link_libraries( ${name} Catch2 Catch2Main ) + target_link_libraries( ${name} Catch2 Catch2WithMain ) set_property(TARGET ${name} PROPERTY CXX_STANDARD 14) set_property(TARGET ${name} PROPERTY CXX_EXTENSIONS OFF) endforeach() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a4a21f7..4b1c81d0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -269,19 +269,22 @@ target_include_directories(Catch2 ) -add_library(Catch2Main STATIC +add_library(Catch2WithMain STATIC ${SOURCES_DIR}/internal/catch_main.cpp ) -add_library(Catch2::Catch2Main ALIAS Catch2Main) -target_link_libraries(Catch2Main PUBLIC Catch2) - +add_library(Catch2::Catch2WithMain ALIAS Catch2WithMain) +target_link_libraries(Catch2WithMain PUBLIC Catch2) +set_target_properties(Catch2WithMain + PROPERTIES + OUTPUT_NAME "Catch2Main" +) if (NOT_SUBPROJECT) # create and install an export set for catch target as Catch2::Catch install( TARGETS Catch2 - Catch2Main + Catch2WithMain EXPORT Catch2Targets DESTINATION @@ -342,5 +345,5 @@ if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS) ) endif() -list(APPEND CATCH_WARNING_TARGETS Catch2 Catch2Main) +list(APPEND CATCH_WARNING_TARGETS Catch2 Catch2WithMain) set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE)