cmake: SPDLOG_BUILD_PIC opt-in for CMAKE_POSITION_INDEPENDENT_CODE
This commit is contained in:
		@@ -36,7 +36,6 @@ if(MSVC)
 | 
				
			|||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set(CMAKE_CXX_EXTENSIONS OFF)
 | 
					set(CMAKE_CXX_EXTENSIONS OFF)
 | 
				
			||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS")
 | 
					if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS")
 | 
				
			||||||
    set(CMAKE_CXX_EXTENSIONS ON)
 | 
					    set(CMAKE_CXX_EXTENSIONS ON)
 | 
				
			||||||
@@ -62,6 +61,9 @@ option(SPDLOG_BUILD_SHARED "Build shared library" OFF)
 | 
				
			|||||||
# precompiled headers option
 | 
					# precompiled headers option
 | 
				
			||||||
option(SPDLOG_ENABLE_PCH "Build static or shared library using precompiled header to speed up compilation time" OFF)
 | 
					option(SPDLOG_ENABLE_PCH "Build static or shared library using precompiled header to speed up compilation time" OFF)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# build position independent code
 | 
				
			||||||
 | 
					option(SPDLOG_BUILD_PIC "Build position independent code (-fPIC)" OFF)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# example options
 | 
					# example options
 | 
				
			||||||
option(SPDLOG_BUILD_EXAMPLE "Build example" ${SPDLOG_MASTER_PROJECT})
 | 
					option(SPDLOG_BUILD_EXAMPLE "Build example" ${SPDLOG_MASTER_PROJECT})
 | 
				
			||||||
option(SPDLOG_BUILD_EXAMPLE_HO "Build header only example" OFF)
 | 
					option(SPDLOG_BUILD_EXAMPLE_HO "Build header only example" OFF)
 | 
				
			||||||
@@ -133,6 +135,10 @@ if(SPDLOG_TIDY)
 | 
				
			|||||||
    message(STATUS "Enabled clang-tidy")
 | 
					    message(STATUS "Enabled clang-tidy")
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if(SPDLOG_BUILD_PIC)
 | 
				
			||||||
 | 
					    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
find_package(Threads REQUIRED)
 | 
					find_package(Threads REQUIRED)
 | 
				
			||||||
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
 | 
					message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
 | 
				
			||||||
# ---------------------------------------------------------------------------------------
 | 
					# ---------------------------------------------------------------------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user