[CMake] How to link in different prebuilt objects based on configuration

Robert Maynard robert.maynard at kitware.com
Tue Dec 18 14:08:26 EST 2018


As far as I know this is a limitation of the MSVC project files, and
CMake errors out on that generator rather than try and build an
invalid project.

Have you tried do something where you have the Config and Release
objects as separate targets that always exist, but selectively
conditionally to them based on the Config setting?

On Thu, Dec 13, 2018 at 2:16 PM Daniel Schepler
<dschepler at scalable-networks.com> wrote:
>
> We have a build here where a large portion of our product is in source code available to customers, but then there is a core which we only distribute as prebuilt "private objects".  However, then when we test the customer-type build on Windows, we get an error like:
>
> ---
> CMake Error in CMakeLists.txt:
> Target "exata" has source files which vary by configuration. This is not
> supported by the "Visual Studio 15 2017 Win64" generator.
>
> Config "Debug":
>
> E:/EXata_7_0/qualnet_dev_13_Dec18/kernel/obj/exata-main-windows-x64-vc14d.obj
>
> Config "Release":
>
> E:/EXata_7_0/qualnet_dev_13_Dec18/kernel/obj/exata-main-windows-x64-vc14.obj
> ---
>
> (This object file is marked with source file property EXTERNAL_OBJECT=1.)
>
> Is this a limitation in Visual Studio projects, or a limitation in CMake?  In either case, what workaround could allow this build to support generating Visual Studio projects?
> --
> Daniel Schepler
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list