Skip to content

Commit

Permalink
Added the -fPIC flag to the supported pch flags
Browse files Browse the repository at this point in the history
  • Loading branch information
dutow committed Mar 16, 2018
1 parent b7f7cba commit bbe911f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion PrecompiledHeader.cmake
Expand Up @@ -65,6 +65,7 @@ endmacro()

function(export_all_flags _filename mode)
set(_include_directories "$<TARGET_PROPERTY:${_target},INCLUDE_DIRECTORIES>")
set(_pic "$<$<BOOL:$<TARGET_PROPERTY:${_target},POSITION_INDEPENDENT_CODE>>:-fPIC\n>")
set(_compile_definitions "$<TARGET_PROPERTY:${_target},COMPILE_DEFINITIONS>")
set(_compile_flags "$<TARGET_PROPERTY:${_target},COMPILE_FLAGS>")
set(_compile_options "$<TARGET_PROPERTY:${_target},COMPILE_OPTIONS>")
Expand Down Expand Up @@ -98,8 +99,9 @@ function(export_all_flags _filename mode)
set(_standard_check "${_standard_check}$<$<AND:$<STREQUAL:${_c_standard},99>,${_has_extensions}>:${CMAKE_C99_EXTENSION_COMPILE_OPTION}>")
set(_standard_check "${_standard_check}$<$<AND:$<STREQUAL:${_c_standard},90>,${_has_extensions}>:${CMAKE_C90_EXTENSION_COMPILE_OPTION}>")
endif()
set(_standard_check "${_standard_check}\n")

file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}${_standard_check}\n")
file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}${_standard_check}${_pic}\n")
endfunction()

function (gcc_pch_targets_for_mode _input _pch_path mode)
Expand Down

0 comments on commit bbe911f

Please sign in to comment.