View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000413CMakepublic2003-12-02 02:542003-12-29 13:48
ReporterGerhard Esterhuizen 
Assigned ToBill Hoffman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000413: CMAKE_CURRENT_SOURCE and ADD_CUSTOM_COMMAND error
DescriptionReferencing the
"CMAKE_CURRENT_SOURCE" variable in a "MAIN_DEPENDENCY" causes CMake error.

The following entry in CMakeLists.txt

ADD_CUSTOM_COMMAND(OUTPUT atarget
                  COMMAND /bin/true
                  MAIN_DEPENDENCY $(CMAKE_CURRENT_SOURCE)/afile)

causes CMake tor output:

-- Check for working C compiler: gcc -- works
-- Check for working CXX compiler: c++ -- works
CMake Error: can not find file
/home/goof/devel/tmp/tcmake/$(CMAKE_CURRENT_SOURCE)/afile

Tried .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h++ .hm .hpp .hxx .in .txx
CMake Error: CMake failed to properly look up cmSourceFile:
$(CMAKE_CURRENT_SOURCE)/afile
-- Configuring done

However, the following entries work:

ADD_CUSTOM_COMMAND(OUTPUT atarget
                   COMMAND /bin/true
                   DEPENDENCIES $(CMAKE_CURRENT_SOURCE)/afile)

ADD_CUSTOM_COMMAND(OUTPUT atarget
                   COMMAND /bin/true
                   MAIN_DEPENDENCY afile)

Therefore, the problem only seems to occur when using "CMAKE_CURRENT_SOURCE" as part of "MAIN_DEPENDANCY".

I only tested this under Linux using CMake 1.8.1.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0000412)
Brad King (manager)
2003-12-29 13:46

CMake variables should be referenced using curly braces "{" and "}". The given example uses parens "(" and ")", which are not expected to work.
(0000413)
Brad King (manager)
2003-12-29 13:48

The parens were working in other dependencies because the make process is expanding them. You probably want

MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/afile

 Issue History
Date Modified Username Field Change


Copyright © 2000 - 2018 MantisBT Team