[CMake] CMake 3.1 and add_executable() without sources
Kevin Wojniak
kainjow at kainjow.com
Mon Jan 5 10:44:51 EST 2015
Hi, I am wondering now that 3.1 is out if using add_executable() without sources and later using target_sources() is a new supported way of creating targets? The docs don’t actually say the sources are optional and you can later use target_sources().
We currently have several macros we reuse for multiple targets across multiple projects but currently require 2 separate macros per functionality to specify target sources (via a shared per-target global variable - yuck) and another for linker options. With 3.1 we can combine these into a single macro without the global var which simplifies our CMakeLists files greatly. But before I start doing this, I want to make sure this an acceptable way going forward.
Thanks,
Kevin
More information about the CMake
mailing list