Skip to content

Commit a071310

Browse files
authored
Merge pull request #20 from michaeltryby/release
Release
2 parents 230f646 + ce077db commit a071310

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# CMake is available at https://cmake.org/download/
2626
#
2727

28-
cmake_minimum_required (VERSION 3.0)
28+
cmake_minimum_required (VERSION 3.13)
2929

3030
if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
3131
message(FATAL_ERROR "In-source builds are disabled.")
@@ -44,6 +44,8 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
4444
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
4545

4646

47+
# Searches for and create install rules for vcruntime.dll, msvcp.dll, etc.
48+
include(InstallRequiredSystemLibraries)
4749

4850
# Sets default install prefix when cmakecache is initialized for first time
4951
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

src/CMakeLists.txt

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ IF (APPLE)
2121
set(CMAKE_MACOSX_RPATH 1)
2222
ENDIF (APPLE)
2323

24-
IF (MSVC)
25-
set(CMAKE_C_FLAGS_RELEASE "/GL")
26-
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
27-
ENDIF (MSVC)
28-
29-
3024

3125
set(HEADER_PATH
3226
"${PROJECT_SOURCE_DIR}/include"
@@ -142,6 +136,25 @@ else()
142136
endif()
143137
endif()
144138

139+
target_compile_options(epanet2
140+
PUBLIC
141+
"$<$<CXX_COMPILER_ID:MSVC>:"
142+
"$<$<CONFIG:Release>:/GL>"
143+
">"
144+
)
145+
146+
target_compile_definitions(epanet2
147+
PUBLIC
148+
"_CRT_SECURE_NO_DEPRECATE"
149+
)
150+
151+
target_link_options(epanet2
152+
PUBLIC
153+
"$<$<CXX_COMPILER_ID:MSVC>:"
154+
"$<$<CONFIG:Release>:/LTCG>"
155+
">"
156+
)
157+
145158
target_include_directories(epanet2
146159
PUBLIC
147160
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
@@ -157,7 +170,7 @@ install(TARGETS epanet2
157170
FRAMEWORK DESTINATION "${TOOL_DIST}"
158171
)
159172

160-
# Need to list files out individually otherwise is won't work
173+
# Need to list files out individually otherwise it won't work
161174
install(
162175
FILES
163176
"${PROJECT_SOURCE_DIR}/include/epanet2.def"

0 commit comments

Comments
 (0)