[CMake] Bug when $ is in the directory path

Peng Yu pengyu.ut at gmail.com
Sun Aug 12 21:21:18 EDT 2012


Hi,

I have the following example copied from the cmake Tests/Tutorial
directory. cmake works fine.



/tmp/xxx/src$ cat.sh *
==> CMakeLists.txt <==
cmake_minimum_required (VERSION 2.6)
project (Tutorial)

# The version number.
set (Tutorial_VERSION_MAJOR 1)
set (Tutorial_VERSION_MINOR 0)

# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
  "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
  "${PROJECT_BINARY_DIR}/TutorialConfig.h"
  )

# add the binary tree to the search path for include files
# so that we will find TutorialConfig.h
include_directories("${PROJECT_BINARY_DIR}")

# add the executable
add_executable(tutorial.exe tutorial.cpp)

==> TutorialConfig.h.in <==
// the configured options and settings for Tutorial
#define Tutorial_VERSION_MAJOR ${Tutorial_VERSION_MAJOR}
#define Tutorial_VERSION_MINOR ${Tutorial_VERSION_MINOR}


==> tutorial.cpp <==
// A simple program that computes the square root of a number
#include <stdio.h>
#include "TutorialConfig.h"

int main (int argc, char *argv[])
{
    fprintf(stdout,"%s Version %d.%d\n",
            argv[0],
            Tutorial_VERSION_MAJOR,
            Tutorial_VERSION_MINOR);
  return 0;
}


When I mv xxx to '$'
/tmp/$$ dir
build  src

I get the following error. This is must be due to a bug in cmake such
that it can not handle directory path with '$' in it. Could anybody
fix it? Thanks!

/tmp/$/build$ cmake ../src/
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/$/build
/tmp/$/build$ dir
CMakeCache.txt  CMakeFiles  Makefile  TutorialConfig.h  cmake_install.cmake
/tmp/$/build$ make
Scanning dependencies of target tutorial.exe
make[2]: *** No rule to make target `/tmp/src/tutorial.cpp', needed by
`CMakeFiles/tutorial.exe.dir/tutorial.cpp.o'.  Stop.
make[1]: *** [CMakeFiles/tutorial.exe.dir/all] Error 2
make: *** [all] Error 2


-- 
Regards,
Peng


More information about the CMake mailing list