[CMake] Mfc flag

Denis Scherbakov denis_scherbakov at yahoo.com
Mon Apr 20 04:28:44 EDT 2009


Elizabeta,

In your code snippet everything is ok. CMAKE_MFC_FLAG is 2 after it is set. No sooner no later. If you give complete example, which does not work, then you'll get an answer.

Did you mean the following?

ADD_SUBDIRECTORY(ProjectA) # MFC_VAR not defined
SET (MFC_VAR 2)
ADD_SUBDIRECTORY(ProjectB) # MFC_VAR == 2

I would advise against declaring variables with CMAKE_ prefix, since they can interfece with internal CMake variables.

Denis

> > //cmakelists.txt
> >
> > add_library(A SHARED ${A_SRC})
> >
> > message(${CMAKE_MFC_FLAG}) # prints nothing
> >
> > set(CMAKE_MFC_FLAG 2)
> >
> > message(${CMAKE_MFC_FLAG}) # prints 2
> >
> > add_library(B SHARED ${B_SRC})


> > I was expecting CMAKE_MFC _FLAG to be set just for
> project B , and not for
> > project A because of the order of processing in the
> cmakelists.txt,
> > but the mfc falg is set for project A also .
> >
> > Is this bug or this is normal behavior ?



      


More information about the CMake mailing list