Skip to content

Commit d762582

Browse files
committed
more build fixes
1 parent a772481 commit d762582

2 files changed

Lines changed: 25 additions & 47 deletions

File tree

CMakeLists.txt

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -115,42 +115,38 @@ if(USE_CONAN AND CONAN_TOOLCHAIN_FOUND)
115115
find_package(Catch2 QUIET)
116116
find_package(cpprestsdk REQUIRED)
117117
find_package(fmt REQUIRED)
118+
find_package(rxcpp QUIET)
118119

119120
# Verify packages were found
120-
set(USE_CONAN_CATCH2 FALSE)
121121
if(TARGET Catch2::Catch2)
122-
set(USE_CONAN_CATCH2 TRUE)
123122
message(STATUS "Found Catch2 from Conan")
124123
else()
125-
message(STATUS "Catch2 from Conan not found, will use bundled version for tests")
124+
message(STATUS "Catch2 from Conan not found - tests will fail if it's not available")
126125
endif()
127126

128127
if(TARGET fmt::fmt AND TARGET cpprestsdk::cpprestsdk)
129128
set(CONAN_LIBS
130129
cpprestsdk::cpprestsdk
131130
fmt::fmt
132131
)
133-
set(FMT_TARGET fmt::fmt)
134132
message(STATUS "Using Conan packages: fmt::fmt, cpprestsdk::cpprestsdk")
133+
# Add rxcpp if found from Conan
134+
if(TARGET RxCpp::RxCpp)
135+
list(APPEND CONAN_LIBS RxCpp::RxCpp)
136+
message(STATUS "Found rxcpp from Conan")
137+
endif()
135138
else()
136-
message(WARNING "Conan packages not found as targets - falling back to bundled fmt")
139+
message(FATAL_ERROR "Required Conan packages not found as targets")
137140
if(NOT TARGET fmt::fmt)
138-
message(WARNING " - fmt::fmt target not found")
141+
message(FATAL_ERROR " - fmt::fmt target not found")
139142
endif()
140143
if(NOT TARGET cpprestsdk::cpprestsdk)
141-
message(WARNING " - cpprestsdk::cpprestsdk target not found")
144+
message(FATAL_ERROR " - cpprestsdk::cpprestsdk target not found")
142145
endif()
143-
set(USE_CONAN OFF)
144146
endif()
145147
else()
146-
# Fallback to bundled fmt (may not work with C++20)
147-
message(WARNING "Using bundled fmt - may not be compatible with C++20")
148-
add_library(fmt STATIC
149-
deps/fmt/src/format.cc
150-
deps/fmt/src/posix.cc
151-
)
152-
target_include_directories(fmt PUBLIC deps/fmt/include)
153-
set(FMT_TARGET fmt)
148+
# Fallback - but deps folder is removed, so this will fail
149+
message(FATAL_ERROR "USE_CONAN is OFF but bundling is no longer supported. Please enable USE_CONAN.")
154150
endif()
155151

156152
# Static library: influxdb-cpp-rest
@@ -165,23 +161,11 @@ add_library(influxdb-cpp-rest STATIC
165161
)
166162
target_include_directories(influxdb-cpp-rest PUBLIC
167163
src/influxdb-cpp-rest
168-
deps/rxcpp/Rx/v2/src/rxcpp
169164
)
170-
if(NOT USE_CONAN)
171-
target_include_directories(influxdb-cpp-rest PUBLIC
172-
deps/fmt/include
173-
)
174-
endif()
175165
target_link_libraries(influxdb-cpp-rest
176166
PUBLIC
177-
${FMT_TARGET}
167+
${CONAN_LIBS}
178168
)
179-
if(USE_CONAN)
180-
target_link_libraries(influxdb-cpp-rest
181-
PUBLIC
182-
${CONAN_LIBS}
183-
)
184-
endif()
185169

186170
# Shared library: influx-c-rest
187171
file(GLOB_RECURSE INFLUX_C_REST_SOURCES
@@ -238,15 +222,12 @@ if(BUILD_TESTING)
238222
target_link_libraries(test-influxdb-cpp-rest
239223
influxdb-cpp-rest
240224
)
241-
if(USE_CONAN_CATCH2 AND TARGET Catch2::Catch2WithMain)
225+
if(TARGET Catch2::Catch2WithMain)
242226
target_link_libraries(test-influxdb-cpp-rest
243227
Catch2::Catch2WithMain
244228
)
245229
else()
246-
# Fallback to bundled catch
247-
target_include_directories(test-influxdb-cpp-rest PRIVATE
248-
deps/catch/single_include
249-
)
230+
message(FATAL_ERROR "Catch2 is required for tests but was not found. Install via Conan.")
250231
endif()
251232
if(USE_CONAN)
252233
target_link_libraries(test-influxdb-cpp-rest
@@ -264,15 +245,12 @@ if(BUILD_TESTING)
264245
target_link_libraries(test-influx-c-rest
265246
influx-c-rest
266247
)
267-
if(USE_CONAN_CATCH2 AND TARGET Catch2::Catch2WithMain)
248+
if(TARGET Catch2::Catch2WithMain)
268249
target_link_libraries(test-influx-c-rest
269250
Catch2::Catch2WithMain
270251
)
271252
else()
272-
# Fallback to bundled catch
273-
target_include_directories(test-influx-c-rest PRIVATE
274-
deps/catch/single_include
275-
)
253+
message(FATAL_ERROR "Catch2 is required for tests but was not found. Install via Conan.")
276254
endif()
277255
if(USE_CONAN)
278256
target_link_libraries(test-influx-c-rest
@@ -292,15 +270,12 @@ if(BUILD_TESTING)
292270
influxdb-cpp-rest
293271
influx-c-rest
294272
)
295-
if(USE_CONAN_CATCH2 AND TARGET Catch2::Catch2WithMain)
273+
if(TARGET Catch2::Catch2WithMain)
296274
target_link_libraries(test-influxdb-cpp-auth
297275
Catch2::Catch2WithMain
298276
)
299277
else()
300-
# Fallback to bundled catch
301-
target_include_directories(test-influxdb-cpp-auth PRIVATE
302-
deps/catch/single_include
303-
)
278+
message(FATAL_ERROR "Catch2 is required for tests but was not found. Install via Conan.")
304279
endif()
305280
if(USE_CONAN)
306281
target_link_libraries(test-influxdb-cpp-auth

conanfile.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ def configure(self):
2626

2727
def requirements(self):
2828
self.requires("cpprestsdk/2.10.19") # Latest stable version
29-
self.requires("catch2/3.5.3", override=True) # Latest stable version
30-
self.requires("fmt/11.1.4", override=True) # Latest stable version with C++20 support
31-
self.requires("rxcpp/4.1.1") # RxCpp library
29+
self.requires("fmt/12.1.0") # Latest stable version with C++20 support
30+
self.requires("rxcpp/4.1.1") # Latest stable version
31+
32+
def build_requirements(self):
33+
# Only for tests - not linked to the library
34+
self.test_requires("catch2/3.11.0")
3235

3336
# Don't use cmake_layout when consuming dependencies - it creates nested build directories
3437
# def layout(self):

0 commit comments

Comments
 (0)