On 6 April 2016 at 09:51, Yves Frederix <yves.frederix+cm...@gmail.com>
wrote:

> [...]
> So, basically, a prerequisite for the above
> to work is that CMake behaves nicely for the following as well:
>
>   add_library(test_lib STATIC existing_file_$<CONFIG>.cpp)
>
> At this moment CMake supports generator expressions in the source
> list, so this "should" work. It does not in practice, however:
>
>   CMake Error in CMakeLists.txt:
>     Target "test_target" has source files which vary by configuration.
> This is
>     not supported by the "Visual Studio 14 2015" generator.
>
> Intuitively I understand why this is not supported (different
> configurations share the same project file in VS, so which source file
> would the project point to?) Is this also a technical limitation
> though? Or do VS project files (and other multiconfig generator
> project files such as xcode) support this setup but was it merely not
> implemented yet?
>

I don't know anything about XCode, unfortunately. However,  Visual Studio
definitely supports a form of varying the source file list of the project
between configurations. That's because a source file can be marked as
_excluded_ from build for a particular configuration. So the solution CMake
could use would be to add all source files from all configurations into the
project, but mark them as excluded from [in]appropriate configurations.

Petr
-- 

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-developers

Reply via email to