Skip to content

Commit 2fa0be4

Browse files
Rearrange some cmake setup steps
Consolidate some of the CMAKE_BUILD_TYPE code. Move the BUILD_SHARED_LIBS declaration before it is used, if it matters. Move the BUILD_TESTING declaration before the CTest stuff so that our default of OFF is respected. Otherwise it is defaulting to ON.
1 parent e774b43 commit 2fa0be4

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
88
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "Coverage")
99
endif()
1010

11+
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
12+
if(${CMAKE_BUILD_TYPE_UPPER} STREQUAL "COVERAGE")
13+
message(STATUS "Adding coverage")
14+
find_package(codecov)
15+
endif()
16+
17+
# By default static library
18+
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
19+
1120
project(LAPACK Fortran C)
1221

1322
set(LAPACK_MAJOR_VERSION 3)
@@ -111,12 +120,13 @@ set(PKG_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
111120

112121
# --------------------------------------------------
113122
# Testing
114-
123+
option(BUILD_TESTING "Build tests" OFF)
115124
enable_testing()
116125
include(CTest)
117126
enable_testing()
118-
# --------------------------------------------------
127+
message(STATUS "Build tests: ${BUILD_TESTING}")
119128

129+
# --------------------------------------------------
120130
# Organize output files. On Windows this also keeps .dll files next
121131
# to the .exe files that need them, making tests easy to run.
122132
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LAPACK_BINARY_DIR}/bin)
@@ -128,12 +138,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LAPACK_BINARY_DIR}/lib)
128138
include(CheckLAPACKCompilerFlags)
129139
CheckLAPACKCompilerFlags()
130140

131-
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
132-
if(${CMAKE_BUILD_TYPE_UPPER} STREQUAL "COVERAGE")
133-
message(STATUS "Adding coverage")
134-
find_package(codecov)
135-
endif()
136-
137141
# --------------------------------------------------
138142
# Check second function
139143

@@ -149,12 +153,6 @@ message(STATUS "--> Will use second_${TIME_FUNC}.f and dsecnd_${TIME_FUNC}.f as
149153
set(SECOND_SRC ${LAPACK_SOURCE_DIR}/INSTALL/second_${TIME_FUNC}.f)
150154
set(DSECOND_SRC ${LAPACK_SOURCE_DIR}/INSTALL/dsecnd_${TIME_FUNC}.f)
151155

152-
# By default static library
153-
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
154-
155-
option(BUILD_TESTING "Build tests" OFF)
156-
message(STATUS "Build tests: ${BUILD_TESTING}")
157-
158156
# deprecated LAPACK and LAPACKE routines
159157
option(BUILD_DEPRECATED "Build deprecated routines" OFF)
160158
message(STATUS "Build deprecated routines: ${BUILD_DEPRECATED}")

0 commit comments

Comments
 (0)