Skip to content

Commit cac6907

Browse files
committed
Activate option to BUILD_WITH_PEDANTIC_WARNINGS
1 parent 7d4538d commit cac6907

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

source/matplot/CMakeLists.txt

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ add_library(matplot
8888
target_include_directories(matplot
8989
PUBLIC $<BUILD_INTERFACE:${MATPLOT_ROOT_DIR}/source>
9090
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
91+
9192
target_link_libraries(matplot
9293
PRIVATE cimg nodesoup std::filesystem)
9394

@@ -101,7 +102,6 @@ if(MSVC)
101102
target_compile_options(matplot PUBLIC /wd4305)
102103
# Fix compile error caused by utf8 character in line_spec.cpp
103104
target_compile_options(matplot PUBLIC /utf-8)
104-
105105
endif()
106106

107107
include(CheckSymbolExists)
@@ -123,13 +123,21 @@ endif()
123123
if (BUILD_FOR_DOCUMENTATION_IMAGES)
124124
message("Building matplot for documentation images. wait() commands will be ignored. ~figure will save the files.")
125125
target_compile_definitions(matplot PUBLIC MATPLOT_BUILD_FOR_DOCUMENTATION_IMAGES)
126-
endif()
126+
endif ()
127127

128128
if (BUILD_HIGH_RESOLUTION_WORLD_MAP)
129129
target_compile_definitions(matplot PUBLIC MATPLOT_BUILD_HIGH_RESOLUTION_WORLD_MAP)
130-
else()
130+
else ()
131131
message("Not including the high resolution maps for geoplots")
132-
endif()
132+
endif ()
133+
134+
if (BUILD_WITH_PEDANTIC_WARNINGS)
135+
if (MSVC)
136+
target_compile_options(matplot PRIVATE /W4 /WX)
137+
else ()
138+
target_compile_options(matplot PRIVATE -Wall -Wextra -pedantic -Werror)
139+
endif ()
140+
endif ()
133141

134142
if (BUILD_EXPERIMENTAL_OPENGL_BACKEND)
135143
# Library for the OpenGL example
@@ -188,17 +196,24 @@ endif()
188196

189197

190198
# Install
191-
if(MASTER_PROJECT)
199+
if (BUILD_INSTALLER)
200+
# Install targets
192201
install(TARGETS matplot
193-
EXPORT Matplot++Targets
194-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
195-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
202+
EXPORT Matplot++Targets
203+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
204+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
205+
)
206+
207+
# Install headers
196208
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
197-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
198-
FILES_MATCHING PATTERN "*.h")
209+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
210+
FILES_MATCHING PATTERN "*.h"
211+
)
199212

213+
# Install cmake script
200214
install(EXPORT Matplot++Targets
201-
FILE Matplot++Targets.cmake
202-
NAMESPACE Matplot++::
203-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Matplot++)
215+
FILE Matplot++Targets.cmake
216+
NAMESPACE Matplot++::
217+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Matplot++
218+
)
204219
endif()

0 commit comments

Comments
 (0)