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

Zhang Peixuan zhangpeixuan.cn at gmail.com
Wed Jun 1 21:05:46 EDT 2016


Thanks for the reply.

unset doesn't work at all.
So I have to use a own CMakelist.txt in sub-diretory?

And other idea?

Thanks,
Peixuan

2016-06-02 0:13 GMT+08:00 David Cole <DLRdave at aol.com>:

> Or just isolate it into its own CMakeLists.txt file in a sub-directory?
>
> On Wed, Jun 1, 2016 at 8:34 AM, Nicholas Braden
> <nicholas11braden at gmail.com> wrote:
> > Have you tried unsetting it after adding the executable in question?
> > If that doesn't work, is it possible to make the MFX executable be the
> > very last executable added in your project?
> >
> > On Wed, Jun 1, 2016 at 4:50 AM, Zhang Peixuan <zhangpeixuan.cn at gmail.com>
> wrote:
> >> 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
> >>
> >> --
> >>
> >> Powered by www.kitware.com
> >>
> >> Please keep messages on-topic and check the CMake FAQ at:
> >> http://www.cmake.org/Wiki/CMake_FAQ
> >>
> >> Kitware offers various services to support the CMake community. For more
> >> information on each offering, please visit:
> >>
> >> CMake Support: http://cmake.org/cmake/help/support.html
> >> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> >> CMake Training Courses: http://cmake.org/cmake/help/training.html
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://public.kitware.com/mailman/listinfo/cmake
> > --
> >
> > Powered by www.kitware.com
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
> >
> > CMake Support: http://cmake.org/cmake/help/support.html
> > CMake Consulting: http://cmake.org/cmake/help/consulting.html
> > CMake Training Courses: http://cmake.org/cmake/help/training.html
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160602/74dede9c/attachment.html>


More information about the CMake mailing list