Can I ignore the key word DEFINED in cmake? -
i have simple question related camke keyword defined. not know in condition keyword necessary , in condition keyword can ignored. following example given illustrate question:
cmake_minimum_required(version 2.8) project(test) if (not abc) set(abc "hello abc") endif() message(${abc}) if (abc) message(${abc}) endif() if (defined abc) message(${abc}) endif()
as can see example, if (variable) , if (defined variable) function same. therefore, question arises: defined necessary? idea appreciated.
i notice variable may defined value can off, , in case variable still defined not on, means if(variable) false while if(defined variable) still true.
set(initial_pass off) if (defined initial_pass) message(${initial_pass}) endif() if (initial_pass) message(${initial_pass}) endif() set(initial_pass on) if (defined initial_pass) message(${initial_pass}) endif() if (initial_pass) message(${initial_pass}) endif()
Comments
Post a Comment