[CMake] override CMAKE_COMMAND

Bill Hoffman bill.hoffman at kitware.com
Thu Jan 10 10:33:21 EST 2008


Levy, Chen wrote:
> Hello, List.
> 
> I have CMake v2.4.7 running on SunOS 5.8 from the binary SunOS tar.gz
> file, but I was unable to patch the libCrun.so.1 libCstd.so.1 on that
> box.
> 
> So here what I have done:
> 
> 0. I have put the CMake distributions in: /some/path/cmake
> 
> 1. I have copied correct libCrun.so.1 libCstd.so.1 into
> /some/path/cmake/lib
> 
> 2. I have moved: /some/path/cmake/bin/cmake -> cmake.bin
> 
> 3. I have created /some/path/cmake/bin/cmake like this:
> 
>   #!/bin/sh
>   LD_LIBRARY_PATH=/some/path/cmake/lib /some/path/cmake/bin/cmake.bin
> 
> 4. Every time I run cmake I do it like this:
> /some/path/cmake/bin/cmake
> -DCMAKE_COMMAND:FILEPATH=/some/path/cmake/bin/cmake
> 
> It is generally works, except when I run gmake, and it detects that the
> Makefile is older then the CMakeList.txt file, in that case it runs the
> ${CMAKE_COMMAND} on it's own accord (without the
> -DCMAKE_COMMAND:FILEPATH=/some/path/cmake/bin/cmake) and in that case
> does:
> 
> ...
> /some/path/cmake/bin/cmake -H/path/to/objs -B/path/to/objs
> --check-build-system CMakeFiles/Makefile.cmake 0
> Re-run cmake file: Makefile older than: /path/to/CMakeLists.txt
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /path/to/objs
> gmake -f CMakeFiles/Makefile2 some-make-target
> gmake[1]: Entering directory `/path/to/objs'
> gmake[1]: *** Warning: File `CMakeFiles/Makefile2' has modification time
> in the future (2008-01-09 16:14:54.508727 > 2008-01-09
> 15:59:46.65257409)
> /some/path/cmake/bin/cmake.bin -H/path/to/objs -B/path/to/objs
> --check-build-system CMakeFiles/Makefile.cmake 0
> ld.so.1: /some/path/cmake/bin/cmake.bin: fatal: libCstd.so.1: open
> failed: No such file or directory
> ...
> 
> Must I run cmake like:
> /some/path/cmake/bin/cmake
> -DCMAKE_COMMAND:STRING="/some/path/cmake/bin/cmake
> -DCMAKE_COMMAND:FILEPATH=/some/path/cmake/bin/cmake"
> And how deeply nested must I do this?
> 
> Is there a better way to override the CMAKE_COMMAND value?
> 
> Note that I must not change the LD_LIBRARY_PATH globally, because I
> don't want to build with those libraries, just to run the cmake binary.
> 

CMAKE_COMMAND is an internal variable that you should never try to set. 
    You can not replace cmake with a shell script, as it figures out 
where it is.  You might want to try do do a build with a rpath of "." 
and then put the libCstd.so.1 next to the cmake executable.

-Bill



More information about the CMake mailing list