CMAKE with parameter

Answered

I have cmake with parameter:


if (${USE} STREQUAL  0)
  add_definitions(-DUSE=0)
  set(BIN_NAME bit-block)
  set(BITHASH_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bithash)
endif()
if (${USE} STREQUAL 1)
  add_definitions(-DUSE=1)
  set(BIN_NAME dash-block)
  set(BITHASH_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dashhash)
endif()

and I call:

cmake -DUSE=0 .

or cmake -DUSE=1 .

I have imported project to CLion and I have error:

CMake Error at CMakeLists.txt:10 (if):
  if given arguments:

    "STREQUAL" "0"

  Unknown arguments specified


-- Configuring incomplete, errors occurred!
See also "/home/andrzej-borucki/CLionProjects/block-exe/cmake-build-debug/CMakeFiles/CMakeOutput.log".

 

 

0
1 comment

Hi! Could you please try passing -DUSE=0 or -DUSE=1 in File | Settings | Build, Execution, Deployment | CMake?

1

Please sign in to leave a comment.