Skip to content
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

Merged
merged 2 commits into from
Jul 3, 2017
Merged

build both shared and static library #954

merged 2 commits into from
Jul 3, 2017

Conversation

jeroen
Copy link
Contributor

@jeroen jeroen commented Jun 16, 2017

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.

@@ -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})
Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@rouault
Copy link
Collaborator

rouault commented Jun 16, 2017

Fails to build on Windows : http://my.cdash.org/buildSummary.php?buildid=1229211

@jeroen
Copy link
Contributor Author

jeroen commented Jun 16, 2017

OK let me condition this on Non windows.

@jeroen
Copy link
Contributor Author

jeroen commented Jun 16, 2017

Thanks, can you try again?

@jeroen
Copy link
Contributor Author

jeroen commented Jun 21, 2017

Ping? This should be good to go. Thanks for reviewing!

@rouault rouault merged commit 5736b1a into uclouvain:master Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants