Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(ENABLE_COMPRESSION "Enable zstd compression support" ON)

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
enable_testing()

# Derive the default for enabling testing from the selected vcpkg features
set(rmqcpp_ENABLE_TESTING_DEFAULT ON)
if(VCPKG_MANIFEST_MODE AND VCPKG_MANIFEST_NO_DEFAULT_FEATURES AND NOT "tests" IN_LIST VCPKG_MANIFEST_FEATURES)
set(rmqcpp_ENABLE_TESTING_DEFAULT OFF)
endif()
option(rmqcpp_ENABLE_TESTING "Enable testing (requires GTest)" ${rmqcpp_ENABLE_TESTING_DEFAULT})
if(rmqcpp_ENABLE_TESTING)
enable_testing()
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down
4 changes: 3 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
add_subdirectory(rmqperftest)
if(rmqcpp_ENABLE_TESTING)
add_subdirectory(rmqperftest)
endif()

if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "XL"))
# The examples don't need to work on these platforms
Expand Down
10 changes: 7 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ endif()
find_package(Boost REQUIRED)
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL REQUIRED)
find_package(GTest REQUIRED)
if(rmqcpp_ENABLE_TESTING)
find_package(GTest REQUIRED)
endif()

# BDE-required subpackages
find_package(bal REQUIRED)

add_subdirectory(rmq)
add_subdirectory(rmqtestmocks)
add_subdirectory(tests)
if(rmqcpp_ENABLE_TESTING)
add_subdirectory(rmqtestmocks)
add_subdirectory(tests)
endif()
12 changes: 11 additions & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@
"dependencies": [
"boost-asio",
"openssl",
"gtest",
"bde",
"pcre2",
"zstd"
],
"features": {
"tests": {
"description": "Build the rmqcpp unit and integration tests",
"dependencies": [
"gtest"
]
}
},
"default-features": [
"tests"
]
}