Skip to content

Commit

Permalink
Turn-on PIC/PIE by default if supported
Browse files Browse the repository at this point in the history
  • Loading branch information
scharlton2 authored Jun 19, 2024
1 parent 9af5dd9 commit 1f34f40
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ jobs:
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G "${{ matrix.generator }}"
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_Fortran_COMPILER=${{ steps.setup-fortran.outputs.fc }}
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ set(PHAST_VERSION_MINOR "0")
set(PHAST_VERSION_PATCH "0")
set(PHAST_REVISION "9000")

include(CheckPIESupported)
check_pie_supported()

# set default windows installation path
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
Expand Down
3 changes: 3 additions & 0 deletions src/phast/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ PhreeqcRM/src/RM_interface.F90

# phastf target
add_library(phastf STATIC ${phastf_SOURCES})
set_property(TARGET phastf PROPERTY POSITION_INDEPENDENT_CODE TRUE)

# phastf defines
target_compile_definitions(phastf
Expand Down Expand Up @@ -329,6 +330,7 @@ PhreeqcRM/src/YAMLPhreeqcRM.h

# PhreeqcRM target
add_library(PhreeqcRM STATIC ${PhreeqcRM_SOURCES})
set_property(TARGET PhreeqcRM PROPERTY POSITION_INDEPENDENT_CODE TRUE)

# c++11
target_compile_features(PhreeqcRM PUBLIC cxx_std_11)
Expand Down Expand Up @@ -401,6 +403,7 @@ endif()

# phast3 target
add_executable(phast3 ${phast3_SOURCES})
set_property(TARGET phast3 PROPERTY POSITION_INDEPENDENT_CODE TRUE)

# phast3 defines
target_compile_definitions(phast3
Expand Down

0 comments on commit 1f34f40

Please # to comment.