Skip to content

Conversation

@paulfd
Copy link

@paulfd paulfd commented Aug 9, 2019

Hi,

I added a couple lines in the CMakeFiles.txt to be able to build against the static library. It works when the library is built using add_subdirectory and should not impact existing targets.

if(ENABLE_STATIC)
add_library(cnpy-static STATIC "cnpy.cpp")
target_link_libraries(cnpy-static PUBLIC ${ZLIB_LIBRARIES})
target_include_directories(cnpy-static PUBLIC ".")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this line or is it necessary? I can build on my machine w/o it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specifically, the target_include_directories command

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you build when including it as a subdirectory?

My CMakeFiles looks like this, more or less...

add_subdirectory(external/cnpy)
[...]
add_executable(tests ${SOURCES})
target_link_libraries(tests Catch2::Catch2 cnpy-static gsl::gsl-lite)

I may be doing it wrong though :) I clone cnpy as a submodule and include it this way, is there a better approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants