Skip to content

Commit

Permalink
Tests/ConfigSources: fix for non main stream CMAKE_BUILD_TYPE
Browse files Browse the repository at this point in the history
- None is a valid CMAKE_BUILD_TYPE
- Most of distros uses None as CMAKE_BUILD_TYPE
- When CMAKE_BUILD_TYPE=None, main_other.cpp will be compiled and linked
  into final executable, this program requires some symbols only exist
  when CUSTOM_CFG_OTHER is defined.
- And CMake also allows other CMAKE_BUILD_TYPE, too, CMake documentation
  specificaly mentions funny CMAKE_BUILD_TYPE like ReLeAsE [1]

Let's define them when non main stream like None is specified as CMAKE_BUILD_TYPE.

[1]: https://cmake.org/cmake/help/v3.20/variable/CMAKE_BUILD_TYPE.html
  • Loading branch information
sgn committed Apr 2, 2021
1 parent a8d2f7f commit ce1cadd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Tests/ConfigSources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ add_custom_command(APPEND
VERBATIM
)
foreach(n RANGE 1 5)
set_property(SOURCE custom${n}_Debug.cpp PROPERTY COMPILE_DEFINITIONS CUSTOM_CFG_DEBUG)
foreach(other Release RelWithDebInfo MinSizeRel)
foreach(other ${CMAKE_BUILD_TYPE} Release RelWithDebInfo MinSizeRel)
set_property(SOURCE custom${n}_${other}.cpp PROPERTY COMPILE_DEFINITIONS CUSTOM_CFG_OTHER)
endforeach()
set_property(SOURCE custom${n}_Debug.cpp PROPERTY COMPILE_DEFINITIONS CUSTOM_CFG_DEBUG)
endforeach()
add_library(Custom STATIC
custom1_$<CONFIG>.cpp
Expand Down

0 comments on commit ce1cadd

Please sign in to comment.