I'm calling my CMakeLists.txt like this:
cmake ../.. -DTARGET=JETSON_NANO Then, this line:
message(STATUS "------------ TARGET: ${TARGET}") prints ------------ TARGET: JETSON_NANO
but this line:
if (TARGET STREQUAL JETSON_NANO) gives error:
if given arguments: "TARGET" "STREQUAL" "JETSON_NANO" Why? TARGET is setted!
STREQUALor some otherifconstruction, it is better to enclose this literal with double quotes:"JETSON_NANO". Otherwise, if the variable with given name exists, CMake will substitute value of the variable instead of the literal. This is, however, unrelated to your issue.