cmake: more comments
This commit is contained in:
parent
2cc2efcc9f
commit
df6b5f4722
@ -32,6 +32,7 @@ option(BUILD_WITH_LIBSTL "Build the libSTL module" ON)
|
|||||||
file(GLOB ALL_SRC_FILES src/gmio_core/* src/gmio_core/internal/*)
|
file(GLOB ALL_SRC_FILES src/gmio_core/* src/gmio_core/internal/*)
|
||||||
set(ALL_SRC_FILES ${ALL_SRC_FILES})
|
set(ALL_SRC_FILES ${ALL_SRC_FILES})
|
||||||
|
|
||||||
|
# Find bit size of the target architecture
|
||||||
math(EXPR GMIO_TARGET_ARCH_BIT_SIZE "8 * ${CMAKE_SIZEOF_VOID_P}")
|
math(EXPR GMIO_TARGET_ARCH_BIT_SIZE "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||||
|
|
||||||
if(NOT BUILD_STRICT_C90)
|
if(NOT BUILD_STRICT_C90)
|
||||||
@ -69,6 +70,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
endif()
|
endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic-errors -fstrict-aliasing")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic-errors -fstrict-aliasing")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Winline -Wextra -Wstrict-aliasing -Wcast-align -Wlogical-op -Wfloat-equal")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Winline -Wextra -Wstrict-aliasing -Wcast-align -Wlogical-op -Wfloat-equal")
|
||||||
|
|
||||||
# Force PIC for GCC, see : https://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3
|
# Force PIC for GCC, see : https://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
endif()
|
endif()
|
||||||
@ -77,15 +79,20 @@ endif()
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Treat all files a C source files
|
# Treat all files a C source files
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TC")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TC")
|
||||||
|
|
||||||
# Set warning level to /W4
|
# Set warning level to /W4
|
||||||
string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||||
|
|
||||||
# Enable /Zc:strictStrings when msvc_ver > 2012 and build_type != Debug
|
# Enable /Zc:strictStrings when msvc_ver > 2012 and build_type != Debug
|
||||||
if((MSVC_VERSION GREATER 1700) AND NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
if((MSVC_VERSION GREATER 1700) AND NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zc:strictStrings")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zc:strictStrings")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Disable deprecation warnings about "non-secure" CRT functions
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Enable DLL generation (export symbols)
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
add_definitions(-DGMIO_LIB_DLL
|
add_definitions(-DGMIO_LIB_DLL
|
||||||
-DGMIO_LIB_MAKE_DLL)
|
-DGMIO_LIB_MAKE_DLL)
|
||||||
|
Loading…
Reference in New Issue
Block a user