[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] get complete list of compile definitions
From:       Robert Schwarzelt <rschwarzelt () gmail ! com>
Date:       2017-03-29 10:33:28
Message-ID: 002801d2a877$e7fc9370$b7f5ba50$ () googlemail ! com
[Download RAW message or body]

Hi all,
I need to implement a code export function, that will only export code used
in a specific project configuration.
For this purpose I want to use unifdef (http://dotat.at/prog/unifdef/),
which is capable of removing unused #ifdef blocks.

The project uses static libraries like in following example:

add_library(
    foo STATIC
    foo.c
)

add_library(
    bar STATIC
    bar.c
)

target_compile_definitions(bar INTERFACE HAVE_BAR)
target_link_libraries(foo LINK_PUBLIC bar)


Now foo.c will be compiled with -DHAVE_BAR at build time.
To create a custom target using unifdef i need this information at cmake
configure time. I expected to find this in the property COMPILE_DEFINITIONS
of either the source file foo.c or target foo, but both are empty.

Does anyone know, how to get a list of definitions (that will be used at
build time) for targets or files?

Regards,
Robert Schwarzelt


-- 

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic