Skip to content

Commit 809195e

Browse files
Update example CMakeList to force default CMAKE_BUILD_TYPE (#416)
Signed-off-by: eProsima <jesuspoderoso@eprosima.com>
1 parent 61a020b commit 809195e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/main/java/com/eprosima/fastdds/idl/templates/CMakeLists.stg

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ group CMakeLists;
1616

1717
cmakelists(solution, test) ::= <<
1818

19+
$if (solution)$
20+
# Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima).
21+
#
22+
# Licensed under the Apache License, Version 2.0 (the "License");
23+
# you may not use this file except in compliance with the License.
24+
# You may obtain a copy of the License at
25+
#
26+
# http://www.apache.org/licenses/LICENSE-2.0
27+
#
28+
# Unless required by applicable law or agreed to in writing, software
29+
# distributed under the License is distributed on an "AS IS" BASIS,
30+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31+
# See the License for the specific language governing permissions and
32+
# limitations under the License.
33+
$endif$
34+
1935
cmake_minimum_required(VERSION 3.20)
2036

2137
project("generated_code")
@@ -41,6 +57,17 @@ $endif$
4157
find_package(fastcdr REQUIRED)
4258
find_package(fastdds 3 REQUIRED)
4359

60+
$if (solution)$
61+
# Set CMAKE_BUILD_TYPE to Release by default.
62+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
63+
message(STATUS "Setting build type to 'Release' as none was specified.")
64+
set(CMAKE_BUILD_TYPE Release CACHE STRING
65+
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
66+
FORCE)
67+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
68+
endif()
69+
$endif$
70+
4471
$solution.projects : { project | $pub_sub_execs(project=project, libraries=solution.libraries, test=test)$}; separator="\n"$
4572

4673
$if (test)$

0 commit comments

Comments
 (0)