-
Notifications
You must be signed in to change notification settings - Fork 77
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
linking cmrc with a shared library #17
Comments
I see the same thing. |
It looks like forcing # Generate the actual static library. Each source file is just a single file
# with a character array compiled in containing the contents of the
# corresponding resource file.
add_library(${name} STATIC ${libcpp})
set_property(TARGET ${name} PROPERTY CMRC_LIBDIR "${libdir}")
set_property(TARGET ${name} PROPERTY CMRC_NAMESPACE "${ARG_NAMESPACE}")
target_link_libraries(${name} PUBLIC cmrc::base)
set_property(TARGET ${name} PROPERTY CMRC_IS_RESOURCE_LIBRARY TRUE)
set_property(TARGET ${name} PROPERTY POSITION_INDEPENDENT_CODE ON) Note the last line. |
I'm just not quite sure if that's a general solution. |
If your root project is a shared library I think that you should apply the following in your CMakeLists.txt:
before adding dependencies, to compile them with -fPIC. Or maybe try adding a property only to cmrc resource library after cmrc_add_resource_library call.
Let me know how these options work for you - to not need to modify the CMakeRC.cmake file |
Thanks @themarpe. You would have to do set_property(TARGET foo-resources PROPERTY POSITION_INDEPENDENT_CODE ON) in your example (aliases are not permitted in |
Linker error when I try to link with cmrc generated library with a
SHARED
library.I want the shared library to be statically linked with the
cmrc_add_resource_library
generated targetthelibx-resources
.If I remove that
SHARED
then everything works fine.The text was updated successfully, but these errors were encountered: