I'm using CMake 3.2.3.

I really need to be able to add options to LINK_FLAGS using generator
expressions. When I use LINK_FLAGS with set_target_properties or
set_property, generator expressions are not expanded.

I noticed that the documentation for target_link_libraries says:

"Item names starting with -, but not -l or -framework, are treated as
linker flags...."

So I tried setting options with target_link_libraries. Unfortunately, it
doesn't work.

Some generator expressions (e.g. $<TARGET_FILE_DIR:target>) error out
during generation:  "Expressions which require the linker language may not
be used while evaluating link libraries".

In case where the generator expressions do evaluate, the VS generator
treats all options as if they were link libraries, so my options end-up in
the list of libraries to link. For example, I end-up with
-PDBSTRIPPED:c:/path/to/lib/mylib.pdb in the Linker>Additional Dependencies
setting.

I'm really stuck. How can I set linker flags that use generator expressions?
-- 

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