WolfireGames / overgrowth

Open Source codebase of the game Overgrowth by Wolfire Games LLC
Apache License 2.0
2.51k stars 260 forks source link

Error while building with CMake #76

Closed 4500zenja1 closed 2 years ago

4500zenja1 commented 2 years ago

Greetings.

I'm currently trying to build this project via CMake, however, while trying to do that according to the instruction, I receive the following data errors:

1> [CMake] CMake Error at bullet3-2.89/CMakeLists.txt:77 (STRING): 1> [CMake] STRING sub-command REPLACE requires at least four arguments. 1> [CMake] CMake Error at bullet3-2.89/CMakeLists.txt:81 (STRING): 1> [CMake] STRING sub-command REPLACE requires at least four arguments.

The code has been taken from the latest version of project. I'm doing all these operations from \overgrowth\Build directory. Among those errors I got some warnings but they're not fatal so I didn't considered to bring up them.

How should I resolve this situation and will there be changes fixing this situation?

The code in question:

...
STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags ${CMAKE_EXE_LINKER_FLAGS_DEBUG}) // <--
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO ${replacementFlags}" )
MESSAGE("CMAKE_EXE_LINKER_FLAGS_DEBUG=${CMAKE_EXE_LINKER_FLAGS_DEBUG}")

STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS}) // <--

SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2})
...

P.S. What are the replacementFlag variables and why there are replacementFlag2 and replacementFlags2 (with s before 2) variables at once?

4500zenja1 commented 2 years ago

Ok, so apparently I found the root of the problem: there should be double quotes (") along the sides of ${...}. Also imo I think replacamentFlags shouldn't be here because you may do the exactly same thing with the flag variables:

STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_DEBUG 
                                       "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
MESSAGE("CMAKE_EXE_LINKER_FLAGS_DEBUG=${CMAKE_EXE_LINKER_FLAGS_DEBUG}")

STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
...

I'm not sure about removing the temp variables, though.

4500zenja1 commented 2 years ago

Looks like I lied a bit about installation: I was building the project within Visual Studio 2022, while I needed to do it within the cmd, folder ...\overgrowth\Build. When I did this, I had no need to apply any of the changes above, therefore, the issue is closed now. Oops