CMake provides a simple declarative statement to enable PIC, so no compiler dependent handling is required. There is also no need to tell Boost to build with -fPIC, their build system is smart enough. --- CMakeLists.txt | 13 ++++--------- CMakeModules/download_boost.cmake | 2 -- 2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt index ea2fcee..d09a459 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,10 @@ set( CMAKE_CXX_VISIBILITY_PRESET "hidden" ) set( CMAKE_VISIBILITY_INLINES_HIDDEN ON ) +# Global setting: build everything position independent +set( CMAKE_POSITION_INDEPENDENT_CODE ON ) + + # CMP0063: CMake < 3.3 does not handle hidden visibility for static libraries, # and 3.3 is backwards compatible when the minimum version is smaller than 3.3. if( POLICY CMP0063 ) @@ -238,15 +242,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) add_definitions(-D__USE_MINGW_ANSI_STDIO=1) else() - # We build DLL/DSOs from static libraries, so create position independent - # code for all cases, since we do not have DLL/DSO specific static - # libraries. Subdirectories via add_subdirectores() reference this - # variable, and it is either set or empty, empty for Windows. - set( PIC_FLAG -fPIC ) - - set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" ) - if( NOT APPLE ) # Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it) set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" ) diff --git a/CMakeModules/download_boost.cmake b/CMakeModules/download_boost.cmake index c29888c..30e34a9 100644 --- a/CMakeModules/download_boost.cmake +++ b/CMakeModules/download_boost.cmake @@ -132,8 +132,6 @@ else() set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} ) # pass to *both* C and C++ compilers - set( BOOST_CFLAGS "cflags=${PIC_FLAG}" ) - set( BOOST_CXXFLAGS "cxxflags=${PIC_FLAG}" ) set( BOOST_INCLUDE "${BOOST_ROOT}/include" ) unset( b2_libs ) endif()
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp