[A] Add option POSITION_INDEPENDENT_CODE for library target (libfort::fort).

This commit is contained in:
seleznevae 2020-02-22 13:33:36 +03:00
parent 7a8e267e9e
commit 90265dd628
3 changed files with 13 additions and 4 deletions

View File

@ -17,6 +17,7 @@
- Refactoring of code that uses vectors.
- Add target export in cmake.
- Add option `FORT_ENABLE_TESTING` to turn on/off building tests and examples.
- Add option `POSITION_INDEPENDENT_CODE` for library target (libfort::fort).
### Docs

View File

@ -11,8 +11,11 @@ target_include_directories(fort
)
set_target_properties(fort
PROPERTIES VERSION ${libfort_VERSION}
SOVERSION ${libfort_SOVERSION})
PROPERTIES
VERSION ${libfort_VERSION}
SOVERSION ${libfort_SOVERSION}
POSITION_INDEPENDENT_CODE ON
)
if(NOT FORT_HAVE_WCHAR)
target_compile_definitions(fort

View File

@ -28,11 +28,16 @@ target_link_libraries(foo-app
add_library(foo-lib
foo-lib.cpp)
target_link_libraries(foo-lib
PRIVATE libfort::fort)
PRIVATE libfort::fort)
add_library(foo-lib-shared SHARED
foo-lib.cpp)
target_link_libraries(foo-lib-shared
PRIVATE libfort::fort)
include(GNUInstallDirs)
install(
TARGETS foo-lib
TARGETS foo-lib foo-lib-shared
EXPORT ${PROJECT_NAME}-targets
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}