Skip to content

Commit

Permalink
Create output directory for Message Compiler tool.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lastique committed Dec 15, 2024
1 parent e9e8579 commit aa0acf3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit aa0acf3

Please sign in to comment.