On 8/27/10 9:17 AM, Kevin Fitch wrote:
I am running into an issue that causing me a bit of trouble:
file(GLOB globOutput test)
returns the absolute path to test (assuming there is a test directory under my current dir). Whereas
file(GLOB globOutput .)
returns an empty string. This is particularly annoying because
file(GLOB globOutput non-existant-dir)
also returns an empty string.

And the follow on to this is that the documentation for IS_DIRECTORY, EXISTS, ... says:
 Behavior is well-defined only for full paths.
What exactly does that mean? Just to clarify, is a "full path" an absolute path (e.g. as determined by IS_ABSOLUTE)? The only way I have found to get an absolute path is to use file(GLOB which works for anything other than .

Kevin Fitch

I'd suggest not using file(GLOB in general, and especially for this purpose or for creating lists of source files.

If you want to know the directories involved in the build, use:

   * CMAKE_SOURCE_DIR
         o 
http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_SOURCE_DIR
   * CMAKE_BINARY_DIR
         o 
http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_BINARY_DIR
   * CMAKE_CURRENT_SOURCE_DIR
         o 
http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CURRENT_SOURCE_DIR
   * CMAKE_CURRENT_BINARY_DIR
         o 
http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CURRENT_BINARY_DIR

To get an absolute path, do the following:

get_filename_component(outputvar "somedir" ABSOLUTE)
http://cmake.org/cmake/help/cmake-2-8-docs.html#command:get_filename_component

Hope this helps!

Ryan

--
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

http://academic.cleardefinition.com/

_______________________________________________
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

Reply via email to