[CMake] Is this possible ?
Benoit Thomas
benoit.thomas at gameloft.com
Thu Feb 18 17:25:01 EST 2010
This is perfect,
Thank you !
On 2010-02-18 17:15, Tyler Roscoe wrote:
> On Thu, Feb 18, 2010 at 05:02:38PM -0500, Benoit Thomas wrote:
>
>> I am trying to do something like this:
>>
>> function (FOO_DEBUG)
>> ...
>> endfunction (FOO_DEBUG)
>>
>> function (FOO_RELEASE)
>> ...
>> endfunction (FOO_RELEASE)
>>
>> foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES})
>> FOO_${CONFIG}
>> endforeach(CONFIG)
>>
>> But naturally, it doesn't work :(
>>
> Check out
> http://www.cmake.org/Wiki/CMake/Language_Syntax#Substitution_of_command_names.
>
> Here's an example of how I use it in my project:
>
> # If this buildable needs to modify CMAKE_CXX_FLAGS*, it will
> # create a macro to handle the modifications.
> if (COMMAND ${PROJECT_NAME}_compiler_linker_flags)
> # We would like to just call
> # ${PROJECT_NAME}_compiler_linker_flags () here, but we
> # can't do it directly. This workaround accomplishes the
> # same thing. See
> # http://www.cmake.org/Wiki/CMake/Language_Syntax#Substitution_of_command_names.
> file (WRITE
> "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_complier_linker_flags.cmake"
> "${PROJECT_NAME}_compiler_linker_flags ()"
> )
> include ("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_complier_linker_flags.cmake")
> endif ()
>
>
> hth,
> tyler
>
>
More information about the CMake
mailing list