[CMake] find_path doesn't work if environment variable has spaces

Iulian-Nicu Şerbănoiu undergraver at gmail.com
Mon Feb 17 16:47:53 EST 2014


Hello,

I'm using cmake 2.8.12 on Windows XP. I have an issue when calling
find_path command if an environment variable contains spaces.


Here is my CMakeLists.txt file:

CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT (CodeTrainerPlugins)

MESSAGE("$ENV{CODETRAINER_PATH}")

FIND_PATH   (CODETRAINER_FRAMEWORK_PATH
                NAMES include/common/ExportApi.h
                PATHS
                    ENV CODETRAINER_PATH
            )


if (CODETRAINER_FRAMEWORK_PATH)
    MESSAGE(STATUS "CodeTrainer Framework found at:
${CODETRAINER_FRAMEWORK_PATH}")
else()
    MESSAGE(FATAL_ERROR "CodeTrainer Framework not found")
endif()

ADD_SUBDIRECTORY(function)
ADD_SUBDIRECTORY(test)


The above script is ok when CODETRAINER_PATH variable doesn't contain any
spaces. But when this variable has spaces in it the script exits with the
above fatal error.

Is there a problem with cmake (at least on Windows) with spaces in
environment variable path?

For a complete example you can check the question I addressed on
stackoverflow:
http://stackoverflow.com/questions/21838695/find-path-doesnt-work-if-environment-variable-has-spaces

Thank you,
Iulian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140217/5ca05c65/attachment.html>


More information about the CMake mailing list