diff --git a/examples/cpp/configuration/CMakeLists.txt b/examples/cpp/configuration/CMakeLists.txt index 33e22f366c7..e64fe0094b2 100644 --- a/examples/cpp/configuration/CMakeLists.txt +++ b/examples/cpp/configuration/CMakeLists.txt @@ -35,6 +35,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring configuration example...") file(GLOB CONFIGURATION_SOURCES_CXX "*.cxx") file(GLOB CONFIGURATION_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/content_filter/CMakeLists.txt b/examples/cpp/content_filter/CMakeLists.txt index 4d50fdcdbde..4454874b563 100644 --- a/examples/cpp/content_filter/CMakeLists.txt +++ b/examples/cpp/content_filter/CMakeLists.txt @@ -25,6 +25,15 @@ if(NOT fastdds_FOUND) find_package(fastdds 3 REQUIRED) endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring content filter example...") file(GLOB CONTENT_FILTER_SOURCES_CXX "*.cxx") diff --git a/examples/cpp/custom_payload_pool/CMakeLists.txt b/examples/cpp/custom_payload_pool/CMakeLists.txt index 7bae9057976..fb6b5834352 100644 --- a/examples/cpp/custom_payload_pool/CMakeLists.txt +++ b/examples/cpp/custom_payload_pool/CMakeLists.txt @@ -34,6 +34,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring custom payload pool example...") file(GLOB CUSTOM_PAYLOAD_POOL_DATA_EXAMPLE_SOURCES_CXX "*.cxx") file(GLOB CUSTOM_PAYLOAD_POOL_DATA_EXAMPLE_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/delivery_mechanisms/CMakeLists.txt b/examples/cpp/delivery_mechanisms/CMakeLists.txt index 4e39a81a0d0..f07a74ba792 100644 --- a/examples/cpp/delivery_mechanisms/CMakeLists.txt +++ b/examples/cpp/delivery_mechanisms/CMakeLists.txt @@ -34,6 +34,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring delivery mechanisms example...") file(GLOB DELIVERY_MECHANISMS_SOURCES_CXX "*.cxx") file(GLOB DELIVERY_MECHANISMS_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/discovery_server/CMakeLists.txt b/examples/cpp/discovery_server/CMakeLists.txt index 44d985226ac..b2ad4f51ebe 100644 --- a/examples/cpp/discovery_server/CMakeLists.txt +++ b/examples/cpp/discovery_server/CMakeLists.txt @@ -34,6 +34,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring discovery server example...") file(GLOB DISCOVERY_SERVER_SOURCES_CXX "*.cxx") file(GLOB DISCOVERY_SERVER_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/flow_control/CMakeLists.txt b/examples/cpp/flow_control/CMakeLists.txt index f84047b8517..532f37d8b2f 100644 --- a/examples/cpp/flow_control/CMakeLists.txt +++ b/examples/cpp/flow_control/CMakeLists.txt @@ -38,6 +38,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring DDS Flow Control example...") file(GLOB DDS_FLOWCONTROL_EXAMPLE_SOURCES_CXX "*.cxx") file(GLOB DDS_FLOWCONTROL_EXAMPLE_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/hello_world/CMakeLists.txt b/examples/cpp/hello_world/CMakeLists.txt index 573fd36c4f4..a2706c4a406 100644 --- a/examples/cpp/hello_world/CMakeLists.txt +++ b/examples/cpp/hello_world/CMakeLists.txt @@ -34,6 +34,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring hello world example...") file(GLOB HELLO_WORLD_SOURCES_CXX "*.cxx") file(GLOB HELLO_WORLD_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/request_reply/CMakeLists.txt b/examples/cpp/request_reply/CMakeLists.txt index bcfc2304383..22259a20343 100644 --- a/examples/cpp/request_reply/CMakeLists.txt +++ b/examples/cpp/request_reply/CMakeLists.txt @@ -34,6 +34,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring ${PROJECT_NAME}...") file(GLOB REQUEST_REPLY_TYPES_SOURCES_CXX "types/*.cxx") file(GLOB REQUEST_REPLY_SOURCES_CXX "*.cxx") diff --git a/examples/cpp/rtps/CMakeLists.txt b/examples/cpp/rtps/CMakeLists.txt index 01114865e24..9b5ea87537a 100644 --- a/examples/cpp/rtps/CMakeLists.txt +++ b/examples/cpp/rtps/CMakeLists.txt @@ -38,6 +38,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring Registered...") file(GLOB RTPS_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/security/CMakeLists.txt b/examples/cpp/security/CMakeLists.txt index b14b531072f..18797ef45ea 100644 --- a/examples/cpp/security/CMakeLists.txt +++ b/examples/cpp/security/CMakeLists.txt @@ -35,6 +35,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring secure hello world example...") file(GLOB SECURE_HELLO_WORLD_SOURCES_CXX "*.cxx") diff --git a/examples/cpp/static_edp_discovery/CMakeLists.txt b/examples/cpp/static_edp_discovery/CMakeLists.txt index 5330d0f8d5a..f8073585f73 100644 --- a/examples/cpp/static_edp_discovery/CMakeLists.txt +++ b/examples/cpp/static_edp_discovery/CMakeLists.txt @@ -35,6 +35,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring static edp discovery example...") file(GLOB STATIC_EDP_DISCOVERY_SOURCES_CXX "*.cxx") file(GLOB STATIC_EDP_DISCOVERY_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/topic_instances/CMakeLists.txt b/examples/cpp/topic_instances/CMakeLists.txt index 8da7a76c5ef..c7ea4a365a0 100644 --- a/examples/cpp/topic_instances/CMakeLists.txt +++ b/examples/cpp/topic_instances/CMakeLists.txt @@ -35,6 +35,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring topic instances example...") file(GLOB TOPIC_INSTANCES_SOURCES_CXX "*.cxx") file(GLOB TOPIC_INSTANCES_SOURCES_CPP "*.cpp") diff --git a/examples/cpp/xtypes/CMakeLists.txt b/examples/cpp/xtypes/CMakeLists.txt index 3f1088a1697..c2427523bbe 100644 --- a/examples/cpp/xtypes/CMakeLists.txt +++ b/examples/cpp/xtypes/CMakeLists.txt @@ -34,6 +34,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() +# Set CMAKE_BUILD_TYPE to Release by default. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + message(STATUS "Configuring ${PROJECT_NAME}...") file(GLOB EXAMPLE_SOURCES "*.cpp")