[CMake] [Cmake] Absolute paths in .cmake, .txt files

Bo Huang BHuang at xrite.com
Thu Sep 4 10:31:17 EDT 2008


It seems there is a ${CMAKE_CURRENT_SOURCE_DIR}) variable. Can I use this in a line such as:

INCLUDE("C:/Users/BHuang/Documents/myProj/myProjSubDir/cmake_install.cmake")

To make it

INCLUDE("${(CMAKE_CURRENT_SOURCE_DIR})/cmake_install.cmake")

If so, how I can set this variable's value? I cannot find it.


Thank you. For us, a Unix open source project we want to use employs CMake to build. I generate Visual Studio project files via CMake since we are on Windows exclusively. Ideally, after this, I would not use CMake any more, but the generated VS .proj .sln still calls CMake scripts in each proj's Custom Build process.


-----Original Message-----
From: Eric NOULARD [mailto:eric.noulard at gmail.com] 
Sent: Thursday, September 04, 2008 10:09 AM
To: Bo Huang
Cc: cmake at cmake.org
Subject: Re: [CMake] [Cmake] Absolute paths in .cmake, .txt files

Le Thu, 4 Sep 2008 09:13:31 -0400,
"Bo Huang" <BHuang at xrite.com> a écrit :

> I observed that in .cmake, .txt, .depend, .sln, .vcproj files, paths
> are always absolute when generated. Is there anyway to automatically
> make them relative or set a global path? So far I can only change the
> Visual Studio paths using macros such as $(SolutionDir).

I think this has already been discussed on the list,
(but I cannot find the reference)
and the answer was CMake has good reason to use absolute path, among
others you can not expect tools/lib/etc... found with FIND_PROGRAM,
FIND_PACKAGE etc...
to be found in the same place for different machine, or
even to find any.

> I wish to do this so my co-workers can run via my pre-generated Visual
> Studio project on their machines. 

You may try to 
SET(CMAKE_SUPPRESS_REGENERATION YES)

but I don't know how well it works.

May be you can only share the source tree and teach them
how to easilly configure their local build tree with an hopefully
easy CMake run?


-- 
Erk


More information about the CMake mailing list