user3126089
user3126089

Reputation: 83

Cmake issue with definitions

I currently try compiling library with CMake and MinGW32-make. I obtain at start following errors :

g++.exe : error : /D: No such file or directory g++.exe : error : WIN32: No such file or directory ... (and same errors with other values)

Why CMake pass /D WIN32 in MinGW instead -DWIN32 ? For example : g++.exe (..) /D WIN32 /D BLABLA (..)

Thanks.

Upvotes: 2

Views: 731

Answers (1)

drescherjm
drescherjm

Reputation: 10857

In CMake when you want to define a preprocessor macro that can be used in Visual Studio and other compilers its best to use -D instead of /D in your add_definitions() or the various CMake compiler flags variables. For example:

add_definitions(-DMYDEFINE)

I always do this even though most of my builds are under some version of Visual Studio.

Upvotes: 3

Related Questions