[CMake] Per-configuration include directories?

Robert Dailey rcdailey at gmail.com
Thu Dec 29 15:14:53 EST 2011


It won't be necessary with link_directories because you can specify
absolute paths to your LIB files in target_link_libraries(). You can also
specify 'debug' or 'optimized' prior to the lib. for example:

target_link_libraries( myproject
   debug "C:/project/libs/debug/zlib.lib"
   optimized "C:/project/libs/release/zlib.lib"
)

---------
Robert Dailey


On Thu, Dec 29, 2011 at 11:23 AM, Kevin Burge <kevin.burge at systemware.com>wrote:

>  Thanks.  I just worked around it by checking the generator for visual
> studio and then doing something like:
>
> include_directories ("path_to_lib/$(Outdir)/include")
>
> That works at least in VS.
>
> I may have to do a similar thing with link_directories.
>
> Kevin
>
>
> On 12/29/2011 11:18 AM, Robert Dailey wrote:
>
> I was asking about this a couple of weeks ago. David Cole has expressed
> interest, and it seems it has been placed on the roadmap to implement this
> feature. However, for the time being this can't be done. There are a couple
> of workarounds I know of, but none of which are CMake workarounds. I've had
> to use preprocessor conditions in my source files to turn certain ones on
> or off depending on my configuration.
>
>  ---------
> Robert Dailey
>
>
> On Thu, Dec 29, 2011 at 10:48 AM, Kevin Burge <kevin.burge at systemware.com>wrote:
>
>> I'm trying to get my large project (built of many sub-projects and
>> external projects) to build correctly in Visual Studio, allowing the user
>> to compile release/debug from the UI.  One problem I have: I'm building an
>> external library, and I've customized ExternalProject to keep
>> per-configuration builds of the external projects.  The problem I'm now
>> facing that I don't see a resolution to: I need include_directories to
>> allow per-configuration includes.  I.e.
>>
>> include_directories (third_party_INCLUDE_DIR_DEBUG)
>>
>> or
>>
>> include_directories (third_party_INCLUDE_DIR_RELEASE)
>>
>> I tried setting COMPILE_FLAGS with -I... for the target, but cmake seems
>> to ignore that when generating the Visual Studio 2005 project files.  There
>> doesn't seem to be a way to force the include into the visual studio
>> project files.
>>
>> Is there a way I can do this?
>>
>> Thanks,
>> Kevin
>>
>> --
>>
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111229/636e5c12/attachment-0001.htm>


More information about the CMake mailing list