Skip to content

Commit

Permalink
Enable PIC for static library on UNIX systems
Browse files Browse the repository at this point in the history
Added an `endif()` statement to close the `if(WIN32)` block.
Introduced a new `if(UNIX)` block to set `POSITION_INDEPENDENT_CODE`
to `ON` for the `lib` target. This ensures the static library is
compiled with Position Independent Code on UNIX systems, which is
necessary for creating shared libraries.
  • Loading branch information
ptahmose committed Oct 6, 2024
1 parent c80378f commit 6b217db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,8 @@ target_include_directories(lib PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) # this is

if(WIN32)
target_compile_definitions(lib PRIVATE _WIN32API=1)
endif()
if(UNIX)
# Enable PIC for the static library
set_target_properties(lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()

0 comments on commit 6b217db

Please sign in to comment.