Skip to content

Commit e2eeafe

Browse files
committed
More fixes to build files
1 parent f700310 commit e2eeafe

File tree

5 files changed

+17
-49
lines changed

5 files changed

+17
-49
lines changed

CMakeLists.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ option(ENABLE_CMAKE_EXPERIMENTAL_FEATURES
5656

5757
include(CTest)
5858

59-
if(WIN32)
60-
set(BUILD_SHARED_LIBS OFF)
61-
else()
62-
option(BUILD_SHARED_LIBS "Build all libraries as shared" ON)
63-
endif()
59+
option(BUILD_SHARED_LIBS "Build all libraries as shared" OFF)
6460

6561
include(GNUInstallDirs)
6662

@@ -72,9 +68,8 @@ set(AVO_LIBRARY AVO)
7268
set(AVO_NAME "AVO2 Library")
7369

7470
set(CMAKE_CXX_STANDARD 98)
75-
set(CMAKE_CXX_STANDARD_REQUIRED OFF)
71+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7672
set(CMAKE_CXX_EXTENSIONS OFF)
77-
set(CMAKE_CXX_EXTENSIONS_REQUIRED OFF)
7873
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
7974

8075
option(BUILD_DOCUMENTATION "Build documentation" OFF)
@@ -139,8 +134,14 @@ if(ENABLE_HARDENING)
139134
else()
140135
if(APPLE)
141136
set(AVO_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
142-
set(CMAKE_REQUIRED_FLAGS
143-
"${CMAKE_REQUIRED_FLAGS} -Werror=unused-command-line-argument")
137+
138+
check_cxx_compiler_flag(-Werror=unused-command-line-argument
139+
AVO_COMPILER_SUPPORTS_WERROR_UNUSED_COMMAND_LINE_ARGUMENT)
140+
141+
if(AVO_COMPILER_SUPPORTS_WERROR_UNUSED_COMMAND_LINE_ARGUMENT)
142+
set(CMAKE_REQUIRED_FLAGS
143+
"${CMAKE_REQUIRED_FLAGS} -Werror=unused-command-line-argument")
144+
endif()
144145
endif()
145146

146147
check_cxx_compiler_flag(-D_FORTIFY_SOURCE=2
@@ -163,7 +164,7 @@ if(ENABLE_HARDENING)
163164
endif()
164165

165166
if(AVO_COMPILER_SUPPORTS_D_FORTIFY_SOURCE_2)
166-
add_compile_options(-D_FORTIFY_SOURCE=2)
167+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>)
167168
endif()
168169
if(AVO_COMPILER_SUPPORTS_FCF_PROTECTION)
169170
add_compile_options(-fcf-protection)
@@ -193,12 +194,12 @@ if(ENABLE_HARDENING)
193194
check_linker_flag(CXX -Wl,-z,separate-code AVO_LINKER_SUPPORTS_Z_SEPARATE_CODE)
194195

195196
if(AVO_LINKER_SUPPORTS_BSYMBOLIC_FUNCTIONS)
196-
add_link_options(-Wl,-Bsymbolic-functions)
197+
add_link_options($<$<NOT:$<CONFIG:Debug>>:-Wl,-Bsymbolic-functions>)
197198
endif()
198199
if(AVO_COMPILER_SUPPORTS_FSANITIZE_SAFE_STACK
199200
AND AVO_LINKER_SUPPORTS_FSANITIZE_SAFE_STACK)
200-
add_compile_options(-fsanitize=safe-stack)
201-
add_link_options(-fsanitize=safe-stack)
201+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fsanitize=safe-stack>)
202+
add_link_options($<$<NOT:$<CONFIG:Debug>>:-fsanitize=safe-stack>)
202203
endif()
203204
if(AVO_LINKER_SUPPORTS_Z_DEFS)
204205
add_link_options(-Wl,-z,defs)

examples/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ if(BUILD_EXAMPLES)
5252
set(AVO_EXAMPLES_INTERPROCEDURAL_OPTIMIZATION OFF)
5353
endif()
5454

55+
include(CheckPIESupported)
56+
check_pie_supported()
57+
5558
add_executable(Circle Circle.cc)
5659
target_compile_definitions(Circle PRIVATE ${AVO_EXAMPLES_COMPILE_DEFINITIONS})
5760
target_link_libraries(Circle PRIVATE ${AVO_LIBRARY})

src/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ cc_library(
120120
srcs = [
121121
"Agent.cc",
122122
"Agent.h",
123-
"Export.cc",
124123
"KdTree.cc",
125124
"KdTree.h",
126125
"Line.cc",

src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ target_sources(${AVO_LIBRARY}
5656
PRIVATE
5757
Agent.cc
5858
Agent.h
59-
Export.cc
6059
KdTree.cc
6160
KdTree.h
6261
Line.cc

src/Export.cc

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)