-
Notifications
You must be signed in to change notification settings - Fork 467
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
build both shared and static library #954
Conversation
src/lib/openjp2/CMakeLists.txt
Outdated
@@ -87,7 +87,9 @@ if(WIN32) | |||
add_definitions(-DOPJ_STATIC) | |||
endif() | |||
endif() | |||
add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS}) | |||
add_library(${OPENJPEG_LIBRARY_NAME} SHARED ${OPENJPEG_SRCS}) | |||
add_library(openjp2_static STATIC ${OPENJPEG_SRCS}) |
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.
Any reason not use ${OPENJPEG_LIBRARY_NAME} as well ? Generally both static and dynamic library have the same basename.
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.
cmake doesn't allow for duplicate target name I think
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.
https://stackoverflow.com/questions/2152077/is-it-possible-to-get-cmake-to-build-both-a-static-and-shared-version-of-the-sam and https://datainfer.wordpress.com/2013/10/24/make-both-static-and-shared-libraries-in-one-build-with-cmake/ give one hint how to do that with set_target_properties(MyLibStatic PROPERTIES OUTPUT_NAME MyLib), but this one must be restricted to non-Windows platform, as Windows apparently need different names.
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.
Yes the PR already uses the set_target_properties
.
Fails to build on Windows : http://my.cdash.org/buildSummary.php?buildid=1229211 |
OK let me condition this on Non windows. |
Thanks, can you try again? |
Ping? This should be good to go. Thanks for reviewing! |
This enabled building a static library, in addition to a shared one. I need this myself for building standalone applications, but I think it is generally useful.
Thank you for your review.