Adam wrote:

> I was hoping there might have been a better way to do this with target
> properties of legacyLib.
> 

There is with cmake 3.1:

 set(isExe $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>)
 target_sources(legacyLib INTERFACE 
  "$<${isExe}:${CMAKE_CURRENT_SOURCE_DIR}/use_symbol.cpp>")

LegacyLib provides a simple source file which gets compiled into executables 
linking to it, and the source file invokes the singleton or whatever.

This kind of use-case was the primary motivation for target_sources.

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7082

Thanks,

Steve.


-- 

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

Reply via email to