[CMake] How to using 'conditional statements at generate time'?

Yuchen Deng loaden at gmail.com
Fri Mar 22 11:31:04 EDT 2013


Thanks for your help!
It's works, and it seems great!!

I just try this command using 2.8.11-rc1:

target_include_directories(${target_php}
>     PRIVATE "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}/SWIG;
> ${PHP5_INCLUDE_PATH}"
> )

It's cool!

2013/3/22 Stephen Kelly <steveire at gmail.com>

> Yuchen Deng wrote:
>
> > hi, there!
> > I was reading the release log in here:
> > http://www.kitware.com/news/home/browse/CMake?
> 2012_11_07&CMake+2.8.10+Just+Released
> > Add see the parts:
> >
> >> Generator expressions, which are used to introduce conditional
> statements
> >> at generate time rather than at CMake compile time, are now available in
> >> more contexts, *notably in the INCLUDE_DIRECTORIES and
> >> COMPILE_DEFINITIONS target properties.* There are also new generator
> >> expressions available in the 2.8.10 release.
> >
> > In many times, I have to add more target in one CMakeLists.txt.
> >
> > My question:
> > How to use for INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS target
> > properties ?
> > Any examples? tests? or docs?
> > Thanks!
> >
>
> Hi there,
>
> I'm impressed that you ask for the tests for this stuff. That's where I
> look
> too when I want to find out how to use something. :)
>
> The relevant tests in the cmake repo are in
>
>  Tests/CMakeCommands/*
>  Tests/GeneratorExpressions
>  Tests/CompileDefinitons/target_prop
>  Tests/IncludeDirectories/TargetIncludeDirectories
>  Tests/ExportImport
>
> The target_include_directories is the more 'high level' API around the more
> low-level INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS properties in the
> other tests.
>
> See the docs like
>
>  cmake --help-property INTERFACE_INCLUDE_DIRECTORIES
>  cmake --help-property INTERFACE_COMPILE_DEFINITIONS
>  cmake --help-variable CMAKE_BUILD_INTERFACE_INCLUDES (note that this will
> be renamed to CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE soon)
>
> See also more information here:
>
>  http://thread.gmane.org/gmane.comp.kde.devel.buildsystem/7778
>
> Thanks for trying the stuff out,
>
> Steve.
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Best Regards
Yuchen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130322/db9bb820/attachment.htm>


More information about the CMake mailing list