[CMake] make - cannot open output file . (dot)

tom at unforbidable.com tom at unforbidable.com
Mon Jul 6 06:04:07 EDT 2009


> tom at unforbidable.com wrote:
> >> tom at unforbidable.com wrote:
> >>> So I tried to set EXECUTABLE_OUTPUT_PATH to the same
> >>> path as PROJECT_BINARY_DIR like so:
> >>>
> >>> SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}"
> CACHE >>> PATH "Single output directory for building all
> >>> executables." FORCE)
> >>>
> >>> This works on Windows (nmake makefiles) but when using
> >>> cmake on Gentoo (standard unix makefiles) and calling
> >>> make then I get the following:
> >>>
> >>> Scanning dependencies of target libfurc
> >>> [ 50%] Building CXX object
> >>>
> >>>
> >>
> libfurc/CMakeFiles/libfurc.dir/base/furcadiasettings.cpp.o
> >>
> /home/tom/opendreamer/src/libfurc/base/furcadiasettings.cp
> >>> p:26:2: warning: no newline at end of file >>> Linking
> CXX static library liblibfurc.a >>> [ 50%] Built target
> libfurc >>> Scanning dependencies of target
> tstfurcsettings >>> [100%] Building CXX object
> >>>
> >>>
> >>
> tstfurcsettings/CMakeFiles/tstfurcsettings.dir/main.cpp.o
> >>> Linking CXX executable . >>
> /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-l
> >>> inux-gnu/bin/ld: cannot open output file .: Is a >>>
> directory collect2: ld returned 1 exit status >>> make[2]:
> *** [tstfurcsettings] Error 1 >>> make[1]: ***
> >>> [tstfurcsettings/CMakeFiles/tstfurcsettings.dir/all]
> >>> Error 2 make: *** [all] Error 2
> >>>
> >>> The dot is clearly there.  I got rid of the error by
> >>> setting the path like so:
> >>>
> >>> SET(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin"
> >>> CACHE PATH "Single output directory for building all
> >>> executables." FORCE)
> >>>
> >>> Both cmakes are the same version (2.6-patch 4). 
> >>>
> >>> I don't think I am doing anything wrong although this
> is >>> my first day with cmake.  I decided to post this in
> case >>> it was not an known problem.  I obviously failed
> to >>> google anything up because the key word is . (dot).
> >>>
> >> Sounds like you created an executable with the name "."
> >> somehow...  What  does your add_executable line look
> like? >>
> >> -Bill
> > 
> > It's just that:
> > ADD_EXECUTABLE(tstfurcsettings main.cpp)
> > 
> > Then again, the makefile is generated correctly on
> > Windows: Linking CXX executable ..\tstfurcsettings.exe
> > [100%] Built target tstfurcsettings
> > 
> > It could be a bug in the Gentoo port of cmake.
> > 
> Strange,  can you create a small project that shows this
> problem?
> 
> 

So I created the small project for you and then in hit me: 
linux executable files have no extension.  And when the name
of the executable is the same as its directory... I feel
stupid all right.

Anyway, even though following this issue make little sense
now, there is still the dot anomaly.  So please find
attached the small project if you are as curious as me and
want to investigate it.  It may 'make' for the first time
but once the CMakeCache.txt is created and you modify
main.cpp and 'make' the dot should manifest then.  When it
occasionally succeeds (i.e. no error is produced) there is
still no executable, of course.

-- 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/tom/smallproject/build/dist
Scanning dependencies of target main
[100%] Building CXX object
main/CMakeFiles/main.dir/main.cpp.o
Linking CXX executable .
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/bin/ld:
cannot open output file .: Is a directory
collect2: ld returned 1 exit status
make[2]: *** [main] Error 1
make[1]: *** [main/CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2

Thanks for your time
Tomas


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smallproject.tar.gz
Type: application/x-gzip
Size: 1260 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090706/86f768b3/attachment-0001.bin>


More information about the CMake mailing list