From 25a3b3c082430df237040ec59292493dd9725205 Mon Sep 17 00:00:00 2001 From: Vladyslav Miachkov Date: Thu, 16 Nov 2023 17:41:54 +0200 Subject: [PATCH] Fix file generation error on multiple CMake configurations reload Propose to move generated file to binary directory because it creates from different CMake configuration at the same time and it is race condition --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d3987c1..ef998c0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,8 +37,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -configure_file(${PROJECT_SOURCE_DIR}/include/maxminddb_config.h.cmake.in - ${PROJECT_SOURCE_DIR}/include/maxminddb_config.h) +configure_file(${PROJECT_SOURCE_DIR}/include/maxminddb_config.h.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/generated/maxminddb_config.h) add_library(maxminddb src/maxminddb.c @@ -79,12 +79,14 @@ endif() target_include_directories(maxminddb PUBLIC $ $ + $ $ + $ ) set(MAXMINDB_HEADERS include/maxminddb.h - include/maxminddb_config.h + ${CMAKE_CURRENT_BINARY_DIR}/generated/maxminddb_config.h ) set_target_properties(maxminddb PROPERTIES PUBLIC_HEADER "${MAXMINDB_HEADERS}")