equal
deleted
inserted
replaced
27 endif() |
27 endif() |
28 |
28 |
29 |
29 |
30 |
30 |
31 if(UNIX) |
31 if(UNIX) |
32 #symbol visibility, not supported on Windows (error out then) |
32 #symbol visibility |
33 check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY) |
33 check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY) |
34 if(HAVE_VISIBILITY) |
34 if(HAVE_VISIBILITY) |
35 add_flag_append(CMAKE_C_FLAGS "-fvisibility=hidden") |
35 add_flag_append(CMAKE_C_FLAGS "-fvisibility=hidden") |
36 add_flag_append(CMAKE_CXX_FLAGS "-fvisibility=hidden") |
36 add_flag_append(CMAKE_CXX_FLAGS "-fvisibility=hidden") |
37 endif() |
37 endif() |
38 |
38 |
39 #check for noexecstack on ELF, Gentoo security |
39 #check for noexecstack on ELF, Gentoo security |
40 set(CMAKE_REQUIRED_FLAGS "-Wl,-z,noexecstack") |
40 set(CMAKE_REQUIRED_FLAGS "-Wl,-znoexecstack") |
41 check_c_compiler_flag("" HAVE_NOEXECSTACK) |
41 check_c_compiler_flag("" HAVE_NOEXECSTACK) |
42 if(HAVE_NOEXECSTACK) |
42 if(HAVE_NOEXECSTACK) |
43 add_linker_flag("-znoexecstack") |
43 add_linker_flag("-znoexecstack") |
44 endif() |
44 endif() |
45 |
45 |
56 if(HAVE_RELROPARTIAL) |
56 if(HAVE_RELROPARTIAL) |
57 add_linker_flag("-zrelro") |
57 add_linker_flag("-zrelro") |
58 endif() |
58 endif() |
59 endif() |
59 endif() |
60 |
60 |
61 #this is actually an optimisation |
61 if(CMAKE_BUILD_TYPE MATCHES "RELEASE") |
62 set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed") |
62 set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed") |
63 check_c_compiler_flag("" HAVE_ASNEEDED) |
63 check_c_compiler_flag("" HAVE_ASNEEDED) |
64 if(HAVE_ASNEEDED) |
64 if(HAVE_ASNEEDED) |
65 add_linker_flag("--as-needed") |
65 add_linker_flag("--as-needed") |
|
66 endif() |
66 endif() |
67 endif() |
67 else(UNIX) |
68 else(UNIX) |
68 #check for ASLR on Windows Vista or later, requires binutils >= 2.20 |
69 #check for ASLR on Windows Vista or later, requires binutils >= 2.20 |
69 set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat") |
70 set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat") |
70 check_c_compiler_flag("" HAVE_WINASLR) |
71 check_c_compiler_flag("" HAVE_WINASLR) |