简体   繁体   中英

CMake and MinGW-w64 include paths

I have a C++ project that needs to be built with CMake and MinGW-W64.

Some libraries (such as zlib, libpng) are in: C:\\Dev\\mingw64-5.3.0\\x86_64-w64-mingw32\\

So I use : -DCMAKE_PREFIX_PATH="C:\\Dev\\mingw64-5.3.0\\x86_64-w64-mingw32"

But, I get a compilation error because the following header is outdated and miss important symbols:

C:\Dev\mingw64-5.3.0\x86_64-w64-mingw32\include\float.h

If I add a compiler flag to search into the proper include directory for float.h:

-DCMAKE_CXX_FLAGS="-isystem C:/Dev/mingw64-5.3.0/lib/gcc/x86_64-w64-mingw32/5.3.0/include"

Then, this does not work, since CMake will add this folder after its generated includes_CXX.rsp

How can I handle this issue? Is there a way to enforce header search path priority?

You could also add the include location(s) to environment variable C_INCLUDE_PATH and CPLUS_INCLUDE_PATH .

To locate the libraries you can do the same for the lib with the LIBRARY_PATH environment variable.

For DLL and EXE files you may even need to add the bin path to PATH .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM