Bug #1827
cmake multi-configuration generator support partly broken
Description
The comment in CMakeLists.txt claims that CMAKE_CONFIGURATION_TYPES is only for Visual Studio but it is also for XCode. Do we care about Xcode?
Also in several places (such as src/GetCompilerInfo.cmake and cmake/gmxBuildType*) CMAKE_BUILD_TYPE is used in a way which doesn't work for multi-configuration generators.
Related issues
History
#1 Updated by Roland Schulz over 5 years ago
To have single- and multi-configuration work the same way for reporting the compiler flags, we would need to add all of the CMAKE_{C|CXX}_FLAGS_* to src/buildinfo.h.cmakein and amend them when adding another build-type. We could then get rid of BUILD_{C|CXX}FLAGS because they wouldn't be needed anymore. Is this OK or do we not want them all in the buildinfo header?
If we don't want that we could only add the few default/important types. But then we probably want to keep using BUILD_{C|CXX}FLAGS for single configuration so that e.g. ASAN still works.
Or we could just disable reporting compiler flags for multi-configuration.
#2 Updated by Teemu Murtola over 5 years ago
- Related to Feature #1120: Make build work with multi-cofiguration generators added
#3 Updated by Teemu Murtola over 5 years ago
Roland Schulz wrote:
To have single- and multi-configuration work the same way for reporting the compiler flags, we would need to add all of the CMAKE_{C|CXX}_FLAGS_* to src/buildinfo.h.cmakein and amend them when adding another build-type. We could then get rid of BUILD_{C|CXX}FLAGS because they wouldn't be needed anymore. Is this OK or do we not want them all in the buildinfo header?
If we don't want that we could only add the few default/important types. But then we probably want to keep using BUILD_{C|CXX}FLAGS for single configuration so that e.g. ASAN still works.
Or we could just disable reporting compiler flags for multi-configuration.
Even more similar (and likely simpler) would be to generate a separate buildinfo.h for each configuration, and just arrange for it to be included when compiling the corresponding build type, e.g., with
include_directories(${CMAKE_BINARY_DIR}/$<CONFIG>)
Not sure which CMake version this works in, though...
#4 Updated by Erik Lindahl about 3 years ago
- Target version set to future
We might want to revisit this once we've simplified the existing CMake checks by getting rid of the last pieces of C code.