@@ -220,6 +220,34 @@ if(USE_CONAN)
220220endif ()
221221target_compile_definitions (influx-c-rest PRIVATE BUILDING_INFLUX_C_REST)
222222
223+ # Put DLL in bin directory (matching test executable location) so tests can find it
224+ # This ensures test-influx-c-rest and test-influxdb-cpp-auth can find influx-c-rest.dll
225+ # On Windows/MSVC (multi-config): bin/Release or bin/Debug via $<CONFIG>
226+ # On Unix (single-config): bin/Release or bin/Debug via CMAKE_BUILD_TYPE
227+ if (CMAKE_CONFIGURATION_TYPES )
228+ # Multi-config generator (Visual Studio, Xcode) - use generator expression directly
229+ set_target_properties (influx-c-rest
230+ PROPERTIES
231+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin/$<CONFIG>"
232+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin/$<CONFIG>"
233+ )
234+ else ()
235+ # Single-config generator (Unix Makefiles, Ninja) - use CMAKE_BUILD_TYPE if set
236+ if (CMAKE_BUILD_TYPE )
237+ set_target_properties (influx-c-rest
238+ PROPERTIES
239+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin/${CMAKE_BUILD_TYPE} "
240+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin/${CMAKE_BUILD_TYPE} "
241+ )
242+ else ()
243+ set_target_properties (influx-c-rest
244+ PROPERTIES
245+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin"
246+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin"
247+ )
248+ endif ()
249+ endif ()
250+
223251# Demo application
224252if (BUILD_DEMO)
225253 add_executable (demo
@@ -323,17 +351,50 @@ add_test(NAME test-influxdb-cpp-rest COMMAND ${CMAKE_BINARY_DIR}/bin/test-influx
323351add_test (NAME test -influx-c-rest COMMAND ${CMAKE_BINARY_DIR} /bin/test -influx-c-rest)
324352add_test (NAME test -influxdb-cpp-auth COMMAND ${CMAKE_BINARY_DIR} /bin/test -influxdb-cpp-auth)
325353
326- # Set output directories for executables
327- set_target_properties (test -influxdb-cpp-rest test -influx-c-rest test -influxdb-cpp-auth
328- PROPERTIES
329- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin"
330- )
331-
332- if (BUILD_DEMO)
333- set_target_properties (demo
354+ # Set output directories for executables - match influx-c-rest DLL location
355+ if (CMAKE_CONFIGURATION_TYPES )
356+ # Multi-config generator (Visual Studio, Xcode)
357+ set_target_properties (test -influxdb-cpp-rest test -influx-c-rest test -influxdb-cpp-auth
334358 PROPERTIES
335- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin"
359+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin/$<CONFIG> "
336360 )
361+ else ()
362+ # Single-config generator
363+ if (CMAKE_BUILD_TYPE )
364+ set_target_properties (test -influxdb-cpp-rest test -influx-c-rest test -influxdb-cpp-auth
365+ PROPERTIES
366+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin/${CMAKE_BUILD_TYPE} "
367+ )
368+ else ()
369+ set_target_properties (test -influxdb-cpp-rest test -influx-c-rest test -influxdb-cpp-auth
370+ PROPERTIES
371+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin"
372+ )
373+ endif ()
374+ endif ()
375+
376+ if (BUILD_DEMO)
377+ # Demo output directory - match test executables location
378+ if (CMAKE_CONFIGURATION_TYPES )
379+ # Multi-config generator (Visual Studio, Xcode)
380+ set_target_properties (demo
381+ PROPERTIES
382+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin/$<CONFIG>"
383+ )
384+ else ()
385+ # Single-config generator
386+ if (CMAKE_BUILD_TYPE )
387+ set_target_properties (demo
388+ PROPERTIES
389+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin/${CMAKE_BUILD_TYPE} "
390+ )
391+ else ()
392+ set_target_properties (demo
393+ PROPERTIES
394+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /bin"
395+ )
396+ endif ()
397+ endif ()
337398endif ()
338399
339400# Installation
0 commit comments