-
Notifications
You must be signed in to change notification settings - Fork 20
[#23543] Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files. #207
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
base: main
Are you sure you want to change the base?
Conversation
52c299e
to
a336102
Compare
Signed-off-by: danipiza <[email protected]>
Signed-off-by: danipiza <[email protected]>
Signed-off-by: danipiza <[email protected]>
if(NOT WIN32) | ||
if(SHARED_LIBRARY_SUFFIX) | ||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".${SHARED_LIBRARY_SUFFIX}") | ||
else() | ||
|
||
# Default values for shared library suffix | ||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | ||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") | ||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | ||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") | ||
endif() | ||
endif() | ||
endif() |
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.
We decided to always change the value. No need of a user's cmake option.
if(NOT WIN32) | |
if(SHARED_LIBRARY_SUFFIX) | |
set(CMAKE_SHARED_LIBRARY_SUFFIX ".${SHARED_LIBRARY_SUFFIX}") | |
else() | |
# Default values for shared library suffix | |
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | |
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") | |
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | |
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") | |
endif() | |
endif() | |
endif() | |
if(NOT WIN32) | |
# Default values for shared library suffix in MacOS | |
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | |
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") | |
endif() | |
endif() |
@@ -41,6 +41,20 @@ find_package(fastdds 3 REQUIRED) | |||
|
|||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | |||
|
|||
if(NOT WIN32) |
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.
This CMakeLists are generated by fastddsgen
. We need a PR to fastddsgen adding the code.
Description
Currently, the way that CMake creates the library files always generates .dylib files on Mac. Compilation will work fine, but attempting to import in any Python app will cause the import to fail, as the interpreter expects .so files for library files.
For some reason, using the flag
--cmake-args " -DCMAKE_SHARED_LIBRARY_SUFFIX=.so"
does not fix the issue. Additionally, setting the variable before the project() line in the CMakeLists also remains inneffective. So, the workaround is to add
set(CMAKE_SHARED_LIBRARY_SUFFIX .so)
right after the project() line.
@Mergifyio backports 2.1.x
Fixes #206
Contributor Checklist
Reviewer Checklist