[CMake] How to use CMAKE_MFC_FLAG for only one on executables?

Zhang Peixuan zhangpeixuan.cn at gmail.com
Wed Jun 1 05:50:31 EDT 2016


Hello All,

I want to use CMake to manage my MFC projects, and I added the following
code:

    set( CMAKE_MFC_FLAG 2)
    add_executable(MFCDemo WIN32
        ${MFC_RESOURCE_FILES}
        ${MFC_HEADER_FILES}
        ${MFC_SOURCE_FILES}
        )
    target_compile_definitions(MFCDemo
        PUBLIC -D_AFXDLL=1
        PUBLIC -D_UNICODE
        PUBLIC -DUNICODE
        )

It works.
However, my question is that: In addition to the MFC executable, I still
have some non-MFC executables,
and once CMAKE_MFC_FLAG is set, all the add_executables' property should be
"Use MFC in a Shared DLL".
In fact, I want only one MFC executable, and make sure all other
executables are "Use Standard Windows Library".
Is there any way to implement it? It seems CMAKE_MFC_FLAG does not work
with set_target_property or other commands.

Thanks,
Peixuan Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160601/dbf2108c/attachment.html>


More information about the CMake mailing list