mirror of
https://github.com/etlegacy/etlegacy-libs.git
synced 2024-11-10 06:42:14 +00:00
cmake can go fPIC itself
This commit is contained in:
parent
fe94a3417f
commit
de6309eca2
3 changed files with 17 additions and 16 deletions
|
@ -5,7 +5,8 @@ set(LIBS_BINARY_DIR ${PROJECT_BINARY_DIR}/libs)
|
|||
set(LIBS_DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads/pgk)
|
||||
set(LIBS_DOWNLOAD_SRC_DIR ${PROJECT_BINARY_DIR}/downloads/src)
|
||||
|
||||
if (UNIX)
|
||||
# keep this check in sync with the external libs build commands
|
||||
if (UNIX AND (BUNDLED_OGG_VORBIS OR BUNDLED_OPENAL OR BUNDLED_LUA))
|
||||
find_program(MAKE NAMES gmake make mingw32-make REQUIRED)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -3,17 +3,6 @@ cmake_minimum_required(VERSION 3.10.3)
|
|||
|
||||
#project(glew)
|
||||
|
||||
if(MINGW OR UNIX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-attributes")
|
||||
|
||||
# this is required for bundled 64bit glew lib
|
||||
# http://stackoverflow.com/questions/7216244/why-is-fpic-absolutely-necessary-on-64-and-not-on-32bit-platforms
|
||||
# note: -mcmodel=large might be an option to set too
|
||||
if(NOT CROSS_COMPILE32)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
endif(NOT CROSS_COMPILE32)
|
||||
endif()
|
||||
|
||||
set(GLEW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
source_group(API FILES ${API})
|
||||
|
||||
|
@ -27,6 +16,17 @@ target_include_directories(bundled_glew PUBLIC ${GLEW_SOURCE_DIR}/include)
|
|||
target_compile_definitions(bundled_glew PUBLIC GLEW_STATIC)
|
||||
set_target_properties(bundled_glew PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
if(MINGW OR UNIX)
|
||||
target_compile_options(bundled_glew PRIVATE "-Wno-attributes")
|
||||
|
||||
# this is required for bundled 64bit glew lib
|
||||
# http://stackoverflow.com/questions/7216244/why-is-fpic-absolutely-necessary-on-64-and-not-on-32bit-platforms
|
||||
# note: -mcmodel=large might be an option to set too
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set_target_properties(bundled_glew PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#install(TARGETS glew
|
||||
# LIBRARY DESTINATION "${GLEW_SOURCE_DIR}/lib/"
|
||||
# ARCHIVE DESTINATION "${GLEW_SOURCE_DIR}/lib/"
|
||||
|
|
|
@ -67,8 +67,8 @@ if(MINGW OR UNIX)
|
|||
# http://stackoverflow.com/questions/7216244/why-is-fpic-absolutely-necessary-on-64-and-not-on-32bit-platforms
|
||||
if(NOT CROSS_COMPILE32)
|
||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
# target_compile_options(sqlite_int INTERFACE "-fPIC")
|
||||
set_target_properties(sqlite_int PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
target_compile_options(sqlite_int INTERFACE "-fPIC")
|
||||
# set_target_properties(sqlite_int PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
endif(NOT CROSS_COMPILE32)
|
||||
endif()
|
||||
|
||||
|
@ -110,7 +110,7 @@ endif()
|
|||
if (SQLITE_BUILD_STATIC)
|
||||
# build static library
|
||||
add_library(${SQLITE_STATIC_NAME} STATIC ${SRC_LIB_FILE})
|
||||
target_link_libraries(${SQLITE_STATIC_NAME} PUBLIC sqlite_int)
|
||||
target_link_libraries(${SQLITE_STATIC_NAME} PRIVATE sqlite_int)
|
||||
endif()
|
||||
|
||||
if (SQLITE_BUILD_SHARED)
|
||||
|
@ -120,7 +120,7 @@ if (SQLITE_BUILD_SHARED)
|
|||
#then we do dll library, so need to export api
|
||||
set_target_properties(${SQLITE_DYN_NAME} PROPERTIES DEFINE_SYMBOL "SQLITE_API=__declspec(dllexport)")
|
||||
endif()
|
||||
target_link_libraries(${SQLITE_DYN_NAME} PUBLIC sqlite_int)
|
||||
target_link_libraries(${SQLITE_DYN_NAME} PRIVATE sqlite_int)
|
||||
endif()
|
||||
|
||||
#install(TARGETS ${TO_INSTALL}
|
||||
|
|
Loading…
Reference in a new issue