Skip to content

Commit 08de2d9

Browse files
authored
Merge pull request #169 from turboencabulator/order
Rearrange some cmake setup steps
2 parents 7abe213 + ed5a018 commit 08de2d9

1 file changed

Lines changed: 23 additions & 24 deletions

File tree

CMakeLists.txt

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
cmake_minimum_required(VERSION 2.8.12)
22

3-
# Set a default build type if none was specified
4-
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
5-
message(STATUS "Setting build type to 'Release' as none was specified.")
6-
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
7-
# Set the possible values of build type for cmake-gui
8-
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "Coverage")
9-
endif()
10-
113
project(LAPACK Fortran C)
124

135
set(LAPACK_MAJOR_VERSION 3)
@@ -18,6 +10,26 @@ set(
1810
${LAPACK_MAJOR_VERSION}.${LAPACK_MINOR_VERSION}.${LAPACK_PATCH_VERSION}
1911
)
2012

13+
# Add the CMake directory for custon CMake modules
14+
set(CMAKE_MODULE_PATH "${LAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH})
15+
16+
# Set a default build type if none was specified
17+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
18+
message(STATUS "Setting build type to 'Release' as none was specified.")
19+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
20+
# Set the possible values of build type for cmake-gui
21+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "Coverage")
22+
endif()
23+
24+
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
25+
if(${CMAKE_BUILD_TYPE_UPPER} STREQUAL "COVERAGE")
26+
message(STATUS "Adding coverage")
27+
find_package(codecov)
28+
endif()
29+
30+
# By default static library
31+
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
32+
2133
include(GNUInstallDirs)
2234

2335
# Updated OSX RPATH settings
@@ -42,8 +54,6 @@ configure_file(
4254
@ONLY
4355
)
4456

45-
# Add the CMake directory for custon CMake modules
46-
set(CMAKE_MODULE_PATH "${LAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH})
4757
include(PreventInSourceBuilds)
4858
include(PreventInBuildInstalls)
4959

@@ -111,12 +121,13 @@ set(PKG_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
111121

112122
# --------------------------------------------------
113123
# Testing
114-
124+
option(BUILD_TESTING "Build tests" OFF)
115125
enable_testing()
116126
include(CTest)
117127
enable_testing()
118-
# --------------------------------------------------
128+
message(STATUS "Build tests: ${BUILD_TESTING}")
119129

130+
# --------------------------------------------------
120131
# Organize output files. On Windows this also keeps .dll files next
121132
# to the .exe files that need them, making tests easy to run.
122133
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LAPACK_BINARY_DIR}/bin)
@@ -128,12 +139,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LAPACK_BINARY_DIR}/lib)
128139
include(CheckLAPACKCompilerFlags)
129140
CheckLAPACKCompilerFlags()
130141

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-
137142
# --------------------------------------------------
138143
# Check second function
139144

@@ -149,12 +154,6 @@ message(STATUS "--> Will use second_${TIME_FUNC}.f and dsecnd_${TIME_FUNC}.f as
149154
set(SECOND_SRC ${LAPACK_SOURCE_DIR}/INSTALL/second_${TIME_FUNC}.f)
150155
set(DSECOND_SRC ${LAPACK_SOURCE_DIR}/INSTALL/dsecnd_${TIME_FUNC}.f)
151156

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-
158157
# deprecated LAPACK and LAPACKE routines
159158
option(BUILD_DEPRECATED "Build deprecated routines" OFF)
160159
message(STATUS "Build deprecated routines: ${BUILD_DEPRECATED}")

0 commit comments

Comments
 (0)