[CMake] Dependency weirdness

Phil Smith phil at voltage.com
Mon Aug 25 18:38:38 EDT 2014


A colleague figured it out. We had:
${CMAKE_CURRENT_SOURCE_DIR}/src/zprotect

But the actual directory name is zProtect, capital P.  Windows "doesn't care", sorta kinda, but apparently CMake or Cygwin or Windows does somehow. If the directory has a period in the name, it works; if it doesn't, it fails. After 40+ years of software I should know better than to be surprised by anything, but I still am...

...phsiii

From: Phil Smith
Sent: Saturday, August 23, 2014 1:18 PM
To: cmake at cmake.org
Cc: zTeam
Subject: Dependency weirdness

A while ago, folks on this list kindly helped me through adding dependency checking for assembler macros with the cross-compiler we use (summary: if module foo.asm uses macro bar.mac, we wanted foo.asm picked up by CMake if bar.mac changed).

I recently realized this was no longer working. I had the old version's source path, and verified that it still worked there, and then that the CMakeLists had not changed in any substantive way.

Some more tinkering led me to try a "This can't possible matter/work" scenario:
The old, working path was named C:\SVN\zFPE4.3.0
The new, broken path was named C:\SVN\zFPE510

I did various renames (4.3.0==>430 and 510==>5.1.0), clean builds,.mac changes, and CMAKEs. The results:

-          If the periods are in the filename, the dependency checking works

-          If no period, it doesn't work

But the dependency code in CMakeLists is:
foreach(entry ${ZPROTECT_ASM_DEPENDENCIES})
   # Convert each entry into a new list
   string(REPLACE "," ";" entry ${entry})
   # Get the source filename from the list
   list(GET entry 0 file)
   # And remove it so we can now traverse the list
   list(REMOVE_AT entry 0)
   # Now traverse the list and set each dependency
   foreach(temp ${entry})
      # Note hard-coded path; MUST be full path, cannot be relative (CMake restriction)
      set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/zprotect/asm/${file} APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/zprotect/asm/${temp})
   endforeach(temp ${entry})
endforeach(entry ${ZPROTECT_ASM_DEPENDENCIES}

I see no periods here...I see commas, but no periods. And I'd've expected it to be more likely that the presence of periods would upset it than their absence!

I added a diagnostic MESSAGE in the code and reran it.

Good:
-- set_property(SOURCE C:/SVN/zFPE5.1.0/src/zprotect/asm/VSHVOLT.asm APPEND PROPERTY OBJECT_DEPENDS C:/SVN/zFPE5.1.0/src/zprotect/asm/VSHVOLTX.mac)
Bad:
-- set_property(SOURCE C:/SVN/zFPE510/src/zprotect/asm/VSHVOLT.asm APPEND PROPERTY OBJECT_DEPENDS C:/SVN/zFPE510/src/zprotect/asm/VSHVOLTX.mac)

Those are identical other than the periods in the directory name, as expected! Any ideas?

cmake --version says:
cmake version 2.8.1

I know this is old but there are reasons. In any case, seems like an odd bug. Is the period perhaps some regex confusion kicking in?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140825/e941e499/attachment-0001.html>


More information about the CMake mailing list