The file mongo-c-driver-r1.14/CMakeLists.txt has logic near the top to suppress mongo test output, that does not appear to work correctly.
The intent appears to be to turn cmake output messages on/off dynamically. However, I've found that once it's turned off, it's just always off.
# Used in MaintainerFlags.cmake to silence errors while testing configs. set (MESSAGES_ENABLED 1) function (message) list (GET ARGV 0 MessageType) if (MESSAGES_ENABLED) list (REMOVE_AT ARGV 0) _message (${MessageType} "${ARGV}") endif () endfunction ()
This issue can be observed with a simple CMake test file such as the following:
- Create the following CMakeLists.txt file in the directory above mongo-c-driver-r1.14
cmake_minimum_required (VERSION 3.8) cmake_policy(SET CMP0011 NEW) cmake_policy(SET CMP0010 NEW) cmake_policy(SET CMP0022 NEW) set(CMAKE_SUPPRESS_REGENERATION TRUE) SET(P_NAME mongo-c-driver) PROJECT(${P_NAME}) MESSAGE(STATUS "") MESSAGE(STATUS "This is before add_subdiretory\n") MESSAGE(STATUS "") add_subdirectory(mongo-c-driver-r1.14) MESSAGE(STATUS "") MESSAGE(STATUS "This is after add_subdiretory\n") MESSAGE(STATUS "")
- Create a sub-directory BUILD In the directory above mongo-c-drvier-r1.14
mkdir BUILD
At this point the directory hierarchy will be:build-root +--CmakeLists.txt | +--BUILD/ | +--mongo-c-driver-r1.14 +--CmakeLists.txt | +--....etc...
- Enter BUILD directory
cd BUILD
- Run cmake
cmake ..
The end result should be output showing "This is before add_subdirectory", all of the stock mongo-c-driver-r1.14 cmake output (with test output suppressed) followed by the string "This is after add_subdirectory"
However, that doesn't happen. All calls to Message() are suppressed after mongo's overloaded message() function comes into play.
Refer to attachment output.txt for an example of the resulting output.
CMake version 3.11.0-rc1 is in use.
A possible fix is for mongodb to change
set (MESSAGES_ENABLED 1)
to
option(MESSAGES_ENABLED "turn on message" 1)
Recomm
- is related to
-
CDRIVER-3756 CMakeLists.txt redefines "message" function
- Closed