[CMake] Get configuration-dependant LOCATION property

Mateusz Loskot mateusz at loskot.net
Mon Oct 4 19:25:36 EDT 2010


On 03/10/10 18:28, Mateusz Loskot wrote:
> Hi,
> 
> I understand what the manual [1] says about LOCATION property that it is
> more or less deprecated. Is that right?
> 
> I'm building software (shared libraries and executables) on both, Linux
> and Windows (using VS 2005, 2008, 2010) and I'm trying to find out what
> would be portable way to get target output location. It is location of
> output directory where toolset genreates .so or .dll files.
> 
> I tried LOCATION property but it is empty (on Windows at least)
> 
> get_target_property(MY_TARGET_LOCATION ${MY_TARGET} LOCATION)
> 
> I tried LOCATION_Debug as well and it returns correct value,
> but now I can't find how to figure out <CONFIG> to generat
> LOCATION_<CONFIG> in CMake run-time.
> 
> I've read CMake FAQ and ml archives and I understand CMAKE_BUILD_TYPE
> doesn't help here as it's supported for make based generators.
> 
> Basically, I'm trying to improve Scott's "add_test and locating
> dependent DLL's on Windows" [2] trick, so it does not stick to using
> LOCATION_Debug property.
> 
> Can anyone suggest solution to how to get target ouptut folder location?

I have solved my problem by globally setting CMAKE_*_OUTPUT_DIRECTORY
variables, so I can have control where to send target output
and where to look for runtime modules.

Thanks to all for brainstorming alternatives.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org


More information about the CMake mailing list