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

Iulian-Nicu Şerbănoiu undergraver at gmail.com
Tue Feb 18 06:59:28 EST 2014


And the solution is to remove quotes from the environment variable.

http://stackoverflow.com/a/21842586/13136


Iulian


On Mon, Feb 17, 2014 at 11:47 PM, Iulian-Nicu Şerbănoiu <
undergraver at gmail.com> wrote:

> 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/20140218/a948e6c4/attachment.html>


More information about the CMake mailing list