mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-26 14:41:03 +03:00
Add compile flags and test for compiler options only if we use gcc.
This commit is contained in:
@ -3,6 +3,9 @@
|
|||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
if (UNIX AND NOT WIN32)
|
if (UNIX AND NOT WIN32)
|
||||||
|
if (CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
add_definitions(-Wall -Wextra -Wmissing-prototypes -Wdeclaration-after-statement -Wunused)
|
||||||
|
|
||||||
# with -fPIC
|
# with -fPIC
|
||||||
check_c_compiler_flag("-fPIC" WITH_FPIC)
|
check_c_compiler_flag("-fPIC" WITH_FPIC)
|
||||||
if (WITH_FPIC)
|
if (WITH_FPIC)
|
||||||
@ -34,10 +37,6 @@ if (UNIX AND NOT WIN32)
|
|||||||
add_definitions(${_lfs_CFLAGS})
|
add_definitions(${_lfs_CFLAGS})
|
||||||
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
add_definitions(-Wall -Wextra -Wmissing-prototypes -Wdeclaration-after-statement -Wunused)
|
|
||||||
endif (CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
|
|
||||||
check_c_compiler_flag("-fstack-protector" WITH_STACK_PROTECTOR)
|
check_c_compiler_flag("-fstack-protector" WITH_STACK_PROTECTOR)
|
||||||
if (WITH_STACK_PROTECTOR)
|
if (WITH_STACK_PROTECTOR)
|
||||||
add_definitions(-fstack-protector)
|
add_definitions(-fstack-protector)
|
||||||
@ -47,5 +46,5 @@ if (UNIX AND NOT WIN32)
|
|||||||
if (WITH_FORTIFY_SOURCE)
|
if (WITH_FORTIFY_SOURCE)
|
||||||
add_definitions(-D_FORTIFY_SOURCE=2)
|
add_definitions(-D_FORTIFY_SOURCE=2)
|
||||||
endif (WITH_FORTIFY_SOURCE)
|
endif (WITH_FORTIFY_SOURCE)
|
||||||
|
endif (CMAKE_COMPILER_IS_GNUCC)
|
||||||
endif (UNIX AND NOT WIN32)
|
endif (UNIX AND NOT WIN32)
|
||||||
|
Reference in New Issue
Block a user