-
Notifications
You must be signed in to change notification settings - Fork 382
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
CMake build options BUILD_STATIC_LIBRARY, BUILD_SHARED_LIBRARY, and B… #492
base: master
Are you sure you want to change the base?
CMake build options BUILD_STATIC_LIBRARY, BUILD_SHARED_LIBRARY, and B… #492
Conversation
…UILD_DEVEL_PACKAGE added (default=ON) These three new CMake build options control what kind of libraries will be build and what contents will be put into the resulting package: * BUILD_STATIC_LIBRARY controls if a static restbed library should be build * BUILD_SHARED_LIBRARY controls if a shared restbed library should be build * BUILD_DEVEL_PACKAGE controls if a development package should be build, i.e. C++ header files included The default value for all three options is ON to provide backward-compatibility with older restbed versions which do not offer these build options yet.
8d03bd3
to
8f53309
Compare
How does the addition of CMake options (which do not cause any change unless set to OFF) could affect a regression test?
It seems that either the "yield_callback_leads_to_service_crash" bug isn't really fixed or something else here is fishy. BTW: The result of the tests on Debian 11:
|
if ( WIN32 ) | ||
# Workaround to avoid name clash of static lib and dynamic import lib under windows. | ||
set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}-shared" ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only MSVC uses file names that conflict between shared and static libraries.
Also, the .dll
does not really need the -shared
suffix.
So set the ARCHIVE_OUTPUT_NAME
property additionally.
if ( WIN32 ) | |
# Workaround to avoid name clash of static lib and dynamic import lib under windows. | |
set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}-shared" ) | |
if ( MSVC ) | |
# Workaround to avoid name clash of static lib and dynamic import lib under windows. | |
set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ARCHIVE_OUTPUT_NAME "${PROJECT_NAME}-shared" ) |
This results in the following files:
restbed-shared.lib # import library of restbed.dll (shared library)
restbed.dll # shared library
restbed.lib # static library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback. But I'm not sure what the proposed change of yours has to do with my Pull Request. I just have introduced three boolean switches (which default to ON) and have surrounded already existing CMake code with if ( ) ... endif() (and have indented the lines within it), that's all. It's a very trivial change which should have no impact except offering the possibility to set one (or more) of these new switches to OFF. Therefore I have no idea why one of the tests fails when run on MS-Windows.
Regarding the MS-Windows build: I can neither comment on this nor check it since I'm using Linux only and have no experience with CMake and MS-Windows. But I don't see the correlation with my changes, and furthermore it's a test execution that fails under MS-Windows, not the build, at least that is my understanding.
endif ( ) | ||
|
||
if ( BUILD_SHARED_LIBRARY ) | ||
install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to install restbed.dll
too.
install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) | |
install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} COMPONENT runtime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this proposed change has to do with my Pull Request? I just have indented this already existing line because I have surrounded it with if( )..endif().
If there is something to improve for the MS-Windows build, I suggest making a separate Pull Request.
…UILD_DEVEL_PACKAGE added (default=ON)
These three new CMake build options control what kind of libraries will be build and what contents will be put into the resulting package:
The default value for all three options is ON to provide backward-compatibility with older restbed versions which do not offer these build options yet.