CMake Windows codecheck error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Low
|
Unassigned |
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/
CMake Error: : System Error: Invalid argument
CMake Error: Could not create D:/prog/
With some googling and stuff, I found the problem to be with line 37 (currently) in the src/CMakeLists.txt, this one:
"add_custom_
The same problem and a solution can be found here:
http://<email address hidden>
tags: |
added: buildsystem removed: buildsytem |
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 @@
if (CMAKE_BUILD_TYPE STREQUAL Debug) sourcefile ${WL_SRCS} ${WL_TEST_SRCS}) filename_ component( sourcename ${sourcefile} NAME) }_codecheck_ stamp_) PREFIX_ WL_SRCS ${PREFIX_ WL_SRCS} ;${CMAKE_ CURRENT_ BINARY_ DIR}/codecheck- stamps/ ${stamp} )
foreach(
- string(REGEX REPLACE "\\.|\\/" "_" sourcenoslash ${sourcefile})
+ string(REGEX REPLACE "\\.|\\/|:" "_" sourcenoslash ${sourcefile})
get_
set(stamp ${sourcenoslash
set(