diff --git a/librabbitmq/CMakeLists.txt b/librabbitmq/CMakeLists.txt index 671840b..b46614c 100644 --- a/librabbitmq/CMakeLists.txt +++ b/librabbitmq/CMakeLists.txt @@ -112,11 +112,25 @@ add_definitions(-DAMQP_BUILD -D_CRT_SECURE_NO_WARNINGS) set(RMQ_LIBRARIES ${AMQP_SSL_LIBS} ${SOCKET_LIBRARIES} ${LIBRT} ${CMAKE_THREAD_LIBS_INIT}) +set(PUBLIC_INCLUDE_DIRS + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> + $<INSTALL_INTERFACE:include> +) + +set(PRIVATE_INCLUDE_DIRS + ${CMAKE_CURRENT_BINARY_DIR} +) + if (BUILD_SHARED_LIBS) add_library(rabbitmq SHARED ${RABBITMQ_SOURCES}) target_link_libraries(rabbitmq ${RMQ_LIBRARIES}) + target_include_directories(rabbitmq + PUBLIC ${PUBLIC_INCLUDE_DIRS} + PRIVATE ${PRIVATE_INCLUDE_DIRS} + ) if (WIN32) set_target_properties(rabbitmq PROPERTIES VERSION ${RMQ_VERSION} OUTPUT_NAME rabbitmq.${RMQ_SOVERSION}) else (WIN32) @@ -137,6 +151,10 @@ if (BUILD_STATIC_LIBS) target_link_libraries(rabbitmq-static ${RMQ_LIBRARIES}) + target_include_directories(rabbitmq-static + PUBLIC ${PUBLIC_INCLUDE_DIRS} + PRIVATE ${PRIVATE_INCLUDE_DIRS} + ) set_target_properties(rabbitmq-static PROPERTIES COMPILE_DEFINITIONS AMQP_STATIC) if (WIN32) set_target_properties(rabbitmq-static PROPERTIES