[CMake] Visual Studio Generator: different Link paths for Debug and Release

aaron.meadows at thomsonreuters.com aaron.meadows at thomsonreuters.com
Wed Aug 25 11:50:18 EDT 2010


Ok, I'll give that a shot.  I wonder if I could iterate the list of targets and make the target_link_libraries() calls on them in a loop.

Aaron C. Meadows 

-----Original Message-----
From: Eric Noulard [mailto:eric.noulard at gmail.com] 
Sent: Wednesday, August 25, 2010 9:59 AM
To: Meadows, Aaron C.
Cc: cmake at cmake.org
Subject: Re: [CMake] Visual Studio Generator: different Link paths for Debug and Release

2010/8/25  <aaron.meadows at thomsonreuters.com>:
> Hi all.
>
>
>
> I need to use different link paths for Debug and Release builds of my
> software.  I'm building with the Visual Studio Generator (2005, 2008, etc).
> I had put this in my CMakeLists.txt, but as it turns out, this doesn't do
> what I need (likely because of the single pass to generate the project
> files):
>
>
>
> if(DEBUG)
>
>  link_directories("$ENV{RDFD3RDPARTYDIR}/lib/Debug")
>
> else()
>
>  link_directories("$ENV{RDFD3RDPARTYDIR}/lib/Release")
>
> endif()

I wouldn't use link_directories but

target_link_libraries(<target>
                             debug $ENV{RDFD3RDPARTYDIR}/lib/Debug/whateverlib
                             optimized
$ENV{RDFD3RDPARTYDIR}/lib/Release/whateverlib )


> So, my question: is there a way to have different link directory paths for
> each configuration in visual studio without generating multiple build
> directories for VS?

I think target_link_libraries with full path to lib is preferred to
link_directories + target_link_libraries with no path.



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


This email was sent to you by Thomson Reuters, the global news and information company.
Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.




More information about the CMake mailing list