← Back to team overview

widelands-dev team mailing list archive

[Bug 535616] Re: CMake Windows codecheck error


The problem is the way how the string for the target is created. It
takes the path and replaces "." and "/" by an underscore. This works
fine under unix like systems but not with windows. The problem is the
colon in the path. I fixed it by adding it to the regexp.

--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -24,7 +24,7 @@

   foreach(sourcefile ${WL_SRCS} ${WL_TEST_SRCS})
-    string(REGEX REPLACE "\\.|\\/" "_" sourcenoslash ${sourcefile})
+    string(REGEX REPLACE "\\.|\\/|:" "_" sourcenoslash ${sourcefile})
     get_filename_component(sourcename ${sourcefile} NAME)
     set(stamp ${sourcenoslash}_codecheck_stamp_)
     set(PREFIX_WL_SRCS ${PREFIX_WL_SRCS};${CMAKE_CURRENT_BINARY_DIR}/codecheck-stamps/${stamp})

** Changed in: widelands
       Status: New => Confirmed

** Changed in: widelands
   Importance: Undecided => Low

CMake Windows codecheck error
You received this bug notification because you are a member of Widelands
Developers, which is subscribed to widelands.

Status in Widelands: Confirmed

Bug description:
This happens for me If I try to run cmake on Windows with codecheck, so for example with the default Debug build (though not with Release build). It is a regression from revision 4968. The error messages are like hundreds of these:

"CMake Error: Cannot open file for write: D:/prog/widelands/bzr/widelands/build_cmake/src/CMakeFiles/D:_prog_widelands_bzr_widelands_src_ai_ai_help_structs_cc_codecheck_stamp_.dir/build.make.tmp
CMake Error: : System Error: Invalid argument
CMake Error: Could not create D:/prog/widelands/bzr/widelands/build_cmake/src/CMakeFiles/D:_prog_widelands_bzr_widelands_src_ai_ai_help_structs_cc_codecheck_stamp_.dir/cmake_clean.cmake"

With some googling and stuff, I found the problem to be with line 37 (currently) in the src/CMakeLists.txt, this one:

"add_custom_target(${stamp} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/codecheck-stamps/${stamp})"

The same problem and a solution can be found here:
http://www.mail-archive.com/cmake@xxxxxxxxx/msg03178.html , although I don't understand fully, but for someone more into CMake it might make sense.