CMakeLists.txt: Do not require C++ (#3956)

By default, the project() CMake command defaults to C and C++. [1]
Therefore, CMake might perform tests for both C and C++ compilers as
part of the configuration phase.

However, this has the consequence of the configuration phase to fail if
the system does not have a C++ toolchain installed, even if C++ is not
really used by the top-level project under the default settings.

Some configurations might still require a C++ toolchain, so
enable_language is selectively called under such circumstances.

[1]: https://cmake.org/cmake/help/latest/command/project.html
This commit is contained in:
Xavier Del Campo
2024-12-20 06:05:50 +01:00
committed by GitHub
parent f8f37c8ebb
commit 9598611e35
5 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,7 @@ set (PLATFORM_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR})
add_definitions(-DBH_PLATFORM_WINDOWS)
add_definitions(-DHAVE_STRUCT_TIMESPEC)
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
enable_language(CXX)
include_directories(${PLATFORM_SHARED_DIR})
include_directories(${PLATFORM_SHARED_DIR}/../include)