diff --git a/CMakeLists.txt b/CMakeLists.txt index 35001b6cee..6e2b50da31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ endif() project( kicad ) -cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR ) +cmake_minimum_required( VERSION 2.8.12 FATAL_ERROR ) # because of http://public.kitware.com/Bug/view.php?id=10395 # Path to local CMake modules. @@ -80,6 +80,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 ) @@ -226,15 +230,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 c29888c44d..30e34a9582 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()