accellera-official / systemc

SystemC Reference Implementation
https://systemc.org/overview/systemc/
Apache License 2.0
451 stars 145 forks source link

CMake: `make check` - all tests failing on MacOSX 10.14 (Mojave). #13

Closed capn-freako closed 3 years ago

capn-freako commented 3 years ago

When I attempt to build, using the CMake approach, on a 2018 MacBook Pro running MacOSX 10.14.6 (Mojave), all tests in make check fail, yielding the same error:

CMake Error at /Users/dbanas/Documents/Projects/systemc/cmake/run_test.cmake:104 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

When I look at line 104 of run_test.cmake, I see:

string(REGEX REPLACE "^.*stopped by user.*$" "" RUN_TRIMMED_LOG ${RUN_LOG})

which certainly seems to be providing 6 arguments to the function, unless either the empty quotation or the ${RUN_LOG} is somehow producing a null argument?

$ cmake --version
cmake version 3.21.0-rc2
capn-freako commented 3 years ago

Okay, it looks like the ${RUN_LOG} term is not getting expanded:

$ cat tst.cmake
string(REGEX REPLACE "'^.*stopped by user.*$'" "-" RUN_TRIMMED_LOG ${RUN_LOG})

$ echo ${RUN_LOG}
Line 1.

$ cmake -P tst.cmake --trace
Running with trace output on.
/Users/dbanas/tmp/cmake_tst/tst.cmake(1):  string(REGEX REPLACE '^.*stopped by user.*$' - RUN_TRIMMED_LOG ${RUN_LOG} )
CMake Error at tst.cmake:1 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

(Some editing of `tst.cmake`)

$ cat tst.cmake
# string(REGEX REPLACE "'^.*stopped by user.*$'" "-" RUN_TRIMMED_LOG ${RUN_LOG})
string(REGEX REPLACE "'^.*stopped by user.*$'" "-" RUN_TRIMMED_LOG "Line 1.")

$ cmake -P tst.cmake --trace
Running with trace output on.
/Users/dbanas/tmp/cmake_tst/tst.cmake(2):  string(REGEX REPLACE '^.*stopped by user.*$' - RUN_TRIMMED_LOG Line 1. )
capn-freako commented 3 years ago

I was able to fix this, by selecting "11" as my preferred C++ standard.