On 2013-11-02 13:38, Cyrille Faucheux wrote:
[...] from what I understood from Matthew first answer ("implicit compile
flags [...] for imported tagets"), I was under the impression that I could
get MYPROJECT_STATIC automatically defined when linking another program
against a static version of my library (through its imported target).

Yes and no. *You* have to set the flag as part of your library's interface compile definitions. But once you do that, cmake should export that, and anyone linking to your library (via imported target) should automatically pick up the flag.

I've looked the documentation of target_compile_definitions, but it seems
to be about compiling the library, not linking against its imported target.
Am I right?

No; at least not entirely in the case of 't_c_d({PUBLIC|INTERFACE})'. A PUBLIC definition is used both to compile your library and by anyone linking to it. An INTERFACE definition is used *only* by other targets linking to it.

See also the INTERFACE_COMPILE_DEFINITIONS property and note in the t_c_d documentation how t_c_d affects that property.

--
Matthew

--

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://www.cmake.org/mailman/listinfo/cmake

Reply via email to