mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	Set default CMAKE_BUILD_TYPE to Release before project()
This commit is contained in:
		| @@ -1,7 +1,7 @@ | |||||||
| # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. | # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. | ||||||
| # This file is part of GNSS-SDR. | # This file is part of GNSS-SDR. | ||||||
| # | # | ||||||
| # SPDX-FileCopyrightText: 2010-2021 C. Fernandez-Prades cfernandez(at)cttc.es | # SPDX-FileCopyrightText: 2010-2022 C. Fernandez-Prades cfernandez(at)cttc.es | ||||||
| # SPDX-License-Identifier: BSD-3-Clause | # SPDX-License-Identifier: BSD-3-Clause | ||||||
|  |  | ||||||
| ################################################################################ | ################################################################################ | ||||||
| @@ -11,6 +11,11 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) | |||||||
|     message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.") |     message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.") | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
|  | # Select the release build type by default to get optimization flags. | ||||||
|  | # This has to come before project() which otherwise initializes it. | ||||||
|  | # Build type can still be overridden by setting -DCMAKE_BUILD_TYPE= | ||||||
|  | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") | ||||||
|  |  | ||||||
| cmake_minimum_required(VERSION 2.8.12...3.22) | cmake_minimum_required(VERSION 2.8.12...3.22) | ||||||
| project(gnss-sdr CXX C) | project(gnss-sdr CXX C) | ||||||
| list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) | ||||||
| @@ -219,19 +224,9 @@ include(GnsssdrBuildTypes) | |||||||
| #  - O2WithASM: -O2 -g -save-temps | #  - O2WithASM: -O2 -g -save-temps | ||||||
| #  - O3WithASM: -O3 -g -save-temps | #  - O3WithASM: -O3 -g -save-temps | ||||||
| #  - ASAN: -Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer | #  - ASAN: -Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer | ||||||
| if(NOT CMAKE_BUILD_TYPE) |  | ||||||
|     if(ENABLE_GPERFTOOLS OR ENABLE_GPROF) |  | ||||||
|         set(CMAKE_BUILD_TYPE "RelWithDebInfo") |  | ||||||
|         message(STATUS "Build type not specified: defaulting to RelWithDebInfo.") |  | ||||||
|     else() |  | ||||||
|         set(CMAKE_BUILD_TYPE "Release") |  | ||||||
|         message(STATUS "Build type not specified: defaulting to Release.") |  | ||||||
|     endif() |  | ||||||
| else() |  | ||||||
|     message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.") |  | ||||||
| endif() |  | ||||||
| gnsssdr_check_build_type(${CMAKE_BUILD_TYPE}) | gnsssdr_check_build_type(${CMAKE_BUILD_TYPE}) | ||||||
| set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") | message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.") | ||||||
|  |  | ||||||
| if(NOT (${CMAKE_BUILD_TYPE} STREQUAL "Release")) | if(NOT (${CMAKE_BUILD_TYPE} STREQUAL "Release")) | ||||||
|     set(ENABLE_STRIP OFF) |     set(ENABLE_STRIP OFF) | ||||||
| endif() | endif() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez