Skip to content

Building from release tarball

I have some problems with building sisso++ on mac on conda (in fact, I do not understand why I don't have these problems on linux). In src/CMakeLists.txt:68-69:

execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE COMMIT_ID)
string(REPLACE "\n" "" COMMIT_ID ${COMMIT_ID})

If you build from release, the first command will fail as the release tarball is not a git repo, resulting in an empty COMMIT_ID Then the second string will fatally fail with

      CMake Error at src/CMakeLists.txt:69 (string):
        string sub-command REPLACE requires at least four arguments.

To bypass this, I think it should be sufficient to fence the second string:

execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE COMMIT_ID)
if(COMMIT_ID)
    string(REPLACE "\n" "" COMMIT_ID ${COMMIT_ID})
endif()

But as I don't have the rights to do a proper MR, could you fix it? Thanks!