[CMake] Add configuration support to include_directories()

Andrey Sploshnov ice.nightcrawler at gmail.com
Mon Dec 22 05:11:48 EST 2008


Sorry, I was mistaken. I meant CMAKE_BUILD_TYPE variable. You can find a
description here:

http://www.vtk.org/Wiki/CMake_Useful_Variables

In my example (if you change CMAKE_BUILD_STATUS with CMAKE_BUILD_TYPE, of
cause), CMake adds an appropriate include path for the corresponding
configuration. Configuration is selected by mean of CMAKE_BUILD_TYPE
variable at generation phase.

For example:

cmake -G "Visual Studio 8" -DCMAKE_BUILD_TYPE=Debug c:\myproject

Or you can add the following snippet to set the build type by default:

if (NOT CMAKE_BUILD_TYPE)

  set (CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of the build,
options are: None Debug Release")

endif (NOT CMAKE_BUILD_TYPE)

On Mon, Dec 22, 2008 at 3:45 AM, Robert Dailey <rcdailey at gmail.com> wrote:

> Will this work in Visual Studio? How does CMake know to place the
> appropriate include directories in the appropriate configuration?
>
> I also was not able to find CMAKE_BUILD_STATUS in the 2.6 documentation.
> Where can I read about this variable?
>
> On Sun, Dec 21, 2008 at 1:49 PM, Andrey Sploshnov <
> ice.nightcrawler at gmail.com> wrote:
>
>> May be you need something like this?
>>
>> include_directories (C:\includes\foo\all)
>>
>> if (CMAKE_BUILD_STATUS STREQUAL "Debug")
>>
>>   include_directories (C:\includes\foo\debug)
>>
>> elseif (CMAKE_BUILD_STATUS STREQUAL "Release")
>>
>>   include_directories (C:\includes\foo\release)
>>
>> endif (CMAKE_BUILD_STATUS STREQUAL "Debug")
>>
>> On Thu, Dec 18, 2008 at 11:13 PM, Robert Dailey <rcdailey at gmail.com>wrote:
>>
>>> Would it be possible to add configuration support to
>>> include_directories()? For example, some include directories I only want to
>>> show up in debug, some in release, and some in all configurations. I imagine
>>> this would look a lot like target_link_libraries():
>>>
>>> include_directories(
>>>     C:\includes\foo\all # This include path applies to all configurations
>>>     debug C:\includes\foo\debug # This include path only shows up in
>>> debug configurations
>>>     release C:\includes\foo\release # This include path only shows up in
>>> release configurations
>>> )
>>>
>>> _______________________________________________
>>> CMake mailing list
>>> CMake at cmake.org
>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>
>>
>>
>> --
>> No fate, but what we make!
>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>
>


-- 
No fate, but what we make!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081222/22800964/attachment.htm>


More information about the CMake mailing list