-
Couldn't load subscription status.
- Fork 196
-
I compiled the library by VS2019 and it is really a wonderful tools for my project.
I can only use it as a static library. Is it possible to be run as a run-time library?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
Try setting -DBUILD_SHARED_LIBS=ON when configuring the CMake build.
Beta Was this translation helpful? Give feedback.
All reactions
-
I tried DBUILD_SHARED_LIBS option, while many test cases can't failed. I thought that some variables and procedures need be assigned with DLLEXPORT attributes
Beta Was this translation helpful? Give feedback.
All reactions
-
Maybe worth to also force export of all symbols to avoid declaring them individually with DLLEXPORT:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 78270a5..dce8e30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -94,6 +94,13 @@ set(SRC add_library(${PROJECT_NAME} ${SRC}) +set_target_properties( + ${PROJECT_NAME} + PROPERTIES + POSITION_INDEPENDENT_CODE ON + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0) target_compile_options( ${PROJECT_NAME}
Beta Was this translation helpful? Give feedback.
All reactions
-
Think you! It works now!
Happy Weekend!
Beta Was this translation helpful? Give feedback.