How to set up alternate builds with optional libraries
I have some code which I want to package into two different binaries: one as a command-line tool, and the other using the wxWidgets toolkit. This is a very simple project, all the code is the same except for main(). I would like one build config to use wxmain.cpp and link the wx libs, and the other to use main.cpp and no libs.
Is there an easy way to configure Clion and Cmake to do this?
Thanks.
请先登录再写评论。
Guy,
If I understand your case correctly it's possible to implement specifying one CMake target for wxmain.cpp and link it the wx libs via target_link_libraries() command. Another target will contain only main.cpp. For more information please refer to CMake documantation.
Thanks, this is what i was looking for.
I came up with this: