From aa0acf366d4d78b3ab6a92137b3e1715629b8a3a Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 15 Dec 2024 18:37:25 +0300 Subject: [PATCH] Create output directory for Message Compiler tool. Presumably, windmc.exe from MinGW-w64 fails if the output directory doesn't exist. So create it prior to running the tool. Additionally, removed explicit markup of the tool outputs as generated sources. This should be done automatically by add_custom_command. Also, added the max CMake version to silence its warnings. --- CMakeLists.txt | 8 +++----- test/test_cmake/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8817719a4..3cf8f007e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,9 @@ -# Copyright 2021-2023 Andrey Semashev +# Copyright 2021-2024 Andrey Semashev # # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.5...3.16) project(BoostLog VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) include(CheckCXXSourceCompiles) @@ -258,8 +258,8 @@ if (WIN32) OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.h" "${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.rc" + COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/src/windows" COMMAND "${CMAKE_MC_COMPILER}" - ARGS -h "${CMAKE_CURRENT_BINARY_DIR}/src/windows" -r "${CMAKE_CURRENT_BINARY_DIR}/src/windows" "${CMAKE_CURRENT_SOURCE_DIR}/src/windows/simple_event_log.mc" @@ -269,8 +269,6 @@ if (WIN32) "Building src/windows/simple_event_log.mc" VERBATIM ) - set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.h" PROPERTIES GENERATED TRUE) - set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.rc" PROPERTIES GENERATED TRUE) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Workaround for a windres.exe issue on MinGW-w64: by default, it uses popen to pipe preprocessed diff --git a/test/test_cmake/CMakeLists.txt b/test/test_cmake/CMakeLists.txt index bc9555f16..7f679e234 100644 --- a/test/test_cmake/CMakeLists.txt +++ b/test/test_cmake/CMakeLists.txt @@ -6,7 +6,7 @@ # NOTE: This does NOT run the unit tests for Boost.Log. # It only tests if the CMakeLists.txt file in its root works as expected -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.5...3.16) project(BoostLogCMakeSelfTest)