[CMake] Implicit EXECUTABLE_OUTPUT_PATH in CMake 2.6

Takeshi Abe tabe at fixedpoint.jp
Tue Jan 6 13:08:47 EST 2009


Hi,

I've found a different behavior between CMake 2.6.0 and 2.6.1 on implicit
EXECUTABLE_OUTPUT_PATH. For example, say a simple project named `foo' has a
test `foo':
~$ ls -la foo
total 16
drwxr-xr-x 2 tabe tabe 4096 Jan  7 01:45 .
drwxr-xr-x 5 tabe tabe 4096 Jan  7 02:24 ..
-rw-r--r-- 1 tabe tabe  139 Jan  7 01:45 CMakeLists.txt
-rw-r--r-- 1 tabe tabe   23 Jan  7 01:43 foo.c
~$ cat foo/CMakeLists.txt 
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3 FATAL_ERROR)
ENABLE_TESTING()
ADD_EXECUTABLE(foo "foo.c")
ADD_TEST(foo ${EXECUTABLE_OUTPUT_PATH}/foo)
~$ cat foo/foo.c
int main() {return 0;}
~$ 

Without user-specified EXECUTABLE_OUTPUT_PATH, the test ran with 2.6.1:
~$ mkdir out
~$ cd out
~/out$ cmake2.6.1 ../foo
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- 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
-- 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: /home/tabe/out
~/out$ make && make test
Scanning dependencies of target foo
[100%] Building C object CMakeFiles/foo.dir/foo.o
Linking C executable foo
[100%] Built target foo
Running tests...
Start processing tests
Test project /home/tabe/out
  1/  1 Testing foo                              Passed

100% tests passed, 0 tests failed out of 1
~/out$ 

2.6.0 could not find the executable, though:
~$ mkdir out
~$ cd out
~/out$ cmake2.6.0 ../foo
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- 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
-- 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: /home/tabe/out
~/out$ make && make test
Scanning dependencies of target foo
[100%] Building C object CMakeFiles/foo.dir/foo.o
Linking C executable foo
[100%] Built target foo
Running tests...
Start processing tests
Test project /home/tabe/out
  1/  1 Testing foo                           Could not find executable /foo
Looked in the following places:
//foo
//foo
//Release/foo
//Release/foo
//Debug/foo
//Debug/foo
//MinSizeRel/foo
//MinSizeRel/foo
//RelWithDebInfo/foo
//RelWithDebInfo/foo
//Deployment/foo
//Deployment/foo
//Development/foo
//Development/foo
Unable to find executable: /foo

0% tests passed, 1 tests failed out of 1

The following tests FAILED:
      1 - foo (Not Run)
Errors while running CTest
make: *** [test] Error 8
~/out$ 

Is this a bug, or whatever known/intended?

(And yes, if correct EXECUTABLE_OUTPUT_PATH specified, both ran the test.
Moreover the document on 2.6 tells that the variable is deprecated with 
preferable CMAKE_RUNTIME_OUTPUT_DIRECTORY. So this question maybe worth only
as a reminder about lagacy codes.)

Cheers,
-- Takeshi Abe


More information about the CMake mailing list