[CMake] msys2-mingw64 cmake gives undefined behaviour, can not find include header

Stéphane Ancelot sancelot at numalliance.com
Thu Dec 19 13:26:41 EST 2019


Hi,

Migrating a code to msys2 compilation (cmake inside msys ), it does not 
find an include file for unknwon reason.


the file is located in a project defined as follow:

cmake_minimum_required(VERSION 3.10)
project(include_commun)

add_library(include_commun INTERFACE)
target_include_directories(include_commun INTERFACE   .)


and the project causing error :

cmake_minimum_required(VERSION 3.10)
project(import_export_unix)

add_library(import_export_unix STATIC import_export_unix.h 
import_export_unix.cpp)
set_target_properties(import_export_unix PROPERTIES 
POSITION_INDEPENDENT_CODE TRUE)
target_include_directories(import_export_unix PUBLIC .)
target_link_libraries(import_export_unix PRIVATE include_machine 
include_commun)


error displayed :

[  3%] Building CXX object 
IMPORT_EXPORT_UNIX/CMakeFiles/import_export_unix.dir/import_export_unix.cpp.obj
cd /e/WORKSPACE/BASE_SILFAX_SAFETY/build/IMPORT_EXPORT_UNIX && 
/mingw64/bin/c++.exe 
@CMakeFiles/import_export_unix.dir/includes_CXX.rsp  -o 
CMakeFiles/import_export_unix.dir/import_export_unix.cpp.obj -c 
/e/WORKSPACE/BASE_SILFAX_SAFETY/IMPORT_EXPORT_UNIX/import_export_unix.cpp
E:/WORKSPACE/BASE_SILFAX_SAFETY/IMPORT_EXPORT_UNIX/import_export_unix.cpp:19:10: 
fatal error: defprog.h: No such file or directory

CMakeFiles/import_export_unix.dir/includes_CXX.rsp content :

-I/e/WORKSPACE/BASE_SILFAX_SAFETY/IMPORT_EXPORT_UNIX/. 
-I/e/WORKSPACE/BASE_SILFAX_SAFETY/INCLUDE_MACHINE/. 
-I/e/WORKSPACE/BASE_SILFAX_SAFETY/INCLUDE_COMMUN/.


Regards,

Steph


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191219/b17d3c8b/attachment.html>


More information about the CMake mailing list