mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 01:00:46 +00:00
CMake: Added LDFlags Configuration
This commit is contained in:
@@ -3,11 +3,11 @@ project(cglm LANGUAGES C)
|
||||
|
||||
set(C_STANDARD 99)
|
||||
set(C_STANDARD_REQUIRED YES)
|
||||
set(C_EXTENSIONS NO)
|
||||
|
||||
set(CGLM_BUILD)
|
||||
option(CGLM_STATIC "Static build" ON)
|
||||
option(CGLM_SHARED "Shared build" OFF)
|
||||
option(CGLM_USE_C11 "" OFF)
|
||||
|
||||
if(CGLM_STATIC AND NOT CGLM_SHARED)
|
||||
set(CGLM_BUILD STATIC)
|
||||
@@ -15,6 +15,20 @@ else(CGLM_SHARED)
|
||||
set(CGLM_BUILD SHARED)
|
||||
endif()
|
||||
|
||||
if(CGLM_USE_C11)
|
||||
set(C_STANDARD 99)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
|
||||
list(APPEND LDFLAGS "/W4")
|
||||
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(C_EXTENSIONS YES)
|
||||
list(APPEND LDFLAGS "-Wall" "-Wpedantic" "-Wstrict-aliasing=2")
|
||||
list(APPEND LDFLAGS "-Werror=strict-prototypes" "-fstrict-aliasing" "-O3")
|
||||
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "CLANG")
|
||||
list(APPEND LDFLAGS "-Wall" "-Weverything" "-Wpedantic")
|
||||
endif()
|
||||
|
||||
set(HEADERS
|
||||
include/cglm/simd/arm.h
|
||||
include/cglm/simd/x86.h
|
||||
@@ -131,6 +145,10 @@ target_include_directories(cglm PUBLIC
|
||||
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_PREFIX}>
|
||||
)
|
||||
|
||||
if(LDFLAGS)
|
||||
target_compile_options(cglm PRIVATE ${LDFLAGS})
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS cglm
|
||||
EXPORT cglm
|
||||
@@ -147,5 +165,4 @@ if(CGLM_SHARED)
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/cglm COMPONENT development)
|
||||
|
Reference in New Issue
Block a user