-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[librabbitmq] Fix cannot include header file when using. #25224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8e71b48
fix usage include files
d4308db
update version
bd02fb3
add license
7514ce8
overwrite version
c60cc02
update patch and options
06f3094
update version
d809f06
update patch
d3ee87d
update version
a8c8df9
update patch
6934d56
update version
15e3fdc
delete blank lines
3f0b57f
overwrite version
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| diff --git a/librabbitmq/CMakeLists.txt b/librabbitmq/CMakeLists.txt | ||
| index 671840b..8fe6c94 100644 | ||
| --- a/librabbitmq/CMakeLists.txt | ||
| +++ b/librabbitmq/CMakeLists.txt | ||
| @@ -56,15 +56,15 @@ endif(MSVC) | ||
| # binary directory, and should shadow whats in the source directory | ||
| set(LIBRABBITMQ_INCLUDE_DIRS | ||
| ${CMAKE_CURRENT_BINARY_DIR} | ||
| - ${CMAKE_CURRENT_SOURCE_DIR} | ||
| - ${MSINTTYPES_INCLUDE} | ||
| - ) | ||
| + ${CMAKE_CURRENT_SOURCE_DIR} | ||
| + ${MSINTTYPES_INCLUDE} | ||
| + ) | ||
|
|
||
| include_directories(${LIBRABBITMQ_INCLUDE_DIRS}) | ||
|
|
||
| set(LIBRABBITMQ_INCLUDE_DIRS | ||
| - ${LIBRABBITMQ_INCLUDE_DIRS} | ||
| - PARENT_SCOPE) | ||
| + ${LIBRABBITMQ_INCLUDE_DIRS} | ||
| + PARENT_SCOPE) | ||
|
FrankXie05 marked this conversation as resolved.
Outdated
|
||
|
|
||
| add_definitions(-DHAVE_CONFIG_H) | ||
|
|
||
| @@ -112,56 +112,102 @@ 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} | ||
| + ${SSL_INCLUDE_DIRS} | ||
| +) | ||
| + | ||
| +set(LIBRABBITMQ_INCLUDE_DIRS ${PUBLIC_INCLUDE_DIRS} PARENT_SCOPE) | ||
| + | ||
| + | ||
|
FrankXie05 marked this conversation as resolved.
Outdated
|
||
| if (BUILD_SHARED_LIBS) | ||
| - add_library(rabbitmq SHARED ${RABBITMQ_SOURCES}) | ||
| + | ||
| + if (NOT APPLE) | ||
| + set(CMAKE_INSTALL_RPATH $ORIGIN) | ||
| + endif() | ||
| + | ||
| + add_library(rabbitmq SHARED ) | ||
| + target_sources(rabbitmq PRIVATE ${RABBITMQ_SOURCES}) | ||
|
|
||
| target_link_libraries(rabbitmq ${RMQ_LIBRARIES}) | ||
|
|
||
| + target_include_directories(rabbitmq | ||
| + PUBLIC ${PUBLIC_INCLUDE_DIRS} | ||
| + PRIVATE ${PRIVATE_INCLUDE_DIRS} | ||
| + ) | ||
| + | ||
| + target_compile_definitions(rabbitmq PRIVATE -DHAVE_CONFIG_H) | ||
| + | ||
| + set_target_properties(rabbitmq PROPERTIES | ||
| + VERSION ${RMQ_VERSION} | ||
| + SOVERSION ${RMQ_SOVERSION} | ||
| + ) | ||
| if (WIN32) | ||
| - set_target_properties(rabbitmq PROPERTIES VERSION ${RMQ_VERSION} OUTPUT_NAME rabbitmq.${RMQ_SOVERSION}) | ||
| - else (WIN32) | ||
| - set_target_properties(rabbitmq PROPERTIES VERSION ${RMQ_VERSION} SOVERSION ${RMQ_SOVERSION}) | ||
| - endif (WIN32) | ||
| + set_target_properties(rabbitmq PROPERTIES OUTPUT_NAME rabbitmq.${RMQ_SOVERSION}) | ||
| + endif() | ||
|
|
||
| install(TARGETS rabbitmq EXPORT "${targets_export_name}" | ||
| - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| - ) | ||
| - | ||
| + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| + COMPONENT rabbitmq-c-runtime | ||
| + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| + COMPONENT rabbitmq-c-runtime | ||
| + NAMELINK_COMPONENT runtime-c-development | ||
| + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| + COMPONENT rabbitmq-c-development | ||
| + ) | ||
| set(RMQ_LIBRARY_TARGET rabbitmq) | ||
| -endif (BUILD_SHARED_LIBS) | ||
| +endif() | ||
| + | ||
|
|
||
| if (BUILD_STATIC_LIBS) | ||
| - add_library(rabbitmq-static STATIC ${RABBITMQ_SOURCES}) | ||
| + add_library(rabbitmq-static STATIC ) | ||
| + target_sources(rabbitmq-static PRIVATE ${RABBITMQ_SOURCES}) | ||
|
|
||
| - 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 | ||
| - VERSION ${RMQ_VERSION} | ||
| - OUTPUT_NAME librabbitmq.${RMQ_SOVERSION}) | ||
| + target_compile_definitions(rabbitmq-static | ||
| + PUBLIC -DAMQP_STATIC | ||
| + PRIVATE -DHAVE_CONFIG_H | ||
| + ) | ||
| + | ||
| + | ||
| + target_link_libraries(rabbitmq-static PRIVATE ${RMQ_LIBRARIES}) | ||
|
|
||
| - if(MSVC) | ||
| - set_target_properties(rabbitmq-static PROPERTIES | ||
| - # Embed debugging info in the library itself instead of generating | ||
| - # a .pdb file. | ||
| - COMPILE_OPTIONS "/Z7") | ||
| - endif(MSVC) | ||
| + set_target_properties(rabbitmq-static PROPERTIES | ||
| + VERSION ${RMQ_VERSION} | ||
| + SOVERSION ${RMQ_SOVERSION}) | ||
|
|
||
| - else (WIN32) | ||
| - set_target_properties(rabbitmq-static PROPERTIES VERSION ${RMQ_VERSION} SOVERSION ${RMQ_SOVERSION} OUTPUT_NAME rabbitmq) | ||
| - endif (WIN32) | ||
| + if (WIN32) | ||
| + set_target_properties(rabbitmq-static PROPERTIES OUTPUT_NAME librabbitmq.${RMQ_SOVERSION}) | ||
| + else() | ||
| + set_target_properties(rabbitmq-static PROPERTIES OUTPUT_NAME rabbitmq) | ||
| + endif() | ||
| + | ||
| + if(MSVC) | ||
| + set_target_properties(rabbitmq-static PROPERTIES | ||
| + # Embed debugging info in the library itself instead of generating | ||
| + # a .pdb file. | ||
| + COMPILE_OPTIONS "/Z7") | ||
| + endif(MSVC) | ||
|
|
||
| install(TARGETS rabbitmq-static EXPORT "${targets_export_name}" | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| + COMPONENT rabbitmq-c-development | ||
| ) | ||
|
|
||
| if (NOT DEFINED RMQ_LIBRARY_TARGET) | ||
| set(RMQ_LIBRARY_TARGET rabbitmq-static) | ||
| endif () | ||
| -endif (BUILD_STATIC_LIBS) | ||
| +endif () | ||
|
|
||
| install(FILES | ||
| amqp.h | ||
| @@ -170,6 +216,7 @@ install(FILES | ||
| ${AMQP_SSL_SOCKET_H_PATH} | ||
| ${STDINT_H_INSTALL_FILE} | ||
| DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
| + COMPONENT rabbitmq-c-development | ||
| ) | ||
|
|
||
| set(RMQ_LIBRARY_TARGET ${RMQ_LIBRARY_TARGET} PARENT_SCOPE) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.