@@ -274,6 +274,13 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
274274 conditions[" root" ] = R"cmake( CMKR_ROOT_PROJECT)cmake" ;
275275 conditions[" x64" ] = R"cmake( CMAKE_SIZEOF_VOID_P EQUAL 8)cmake" ;
276276 conditions[" x32" ] = R"cmake( CMAKE_SIZEOF_VOID_P EQUAL 4)cmake" ;
277+ conditions[" android" ] = R"cmake( ANDROID)cmake" ;
278+ conditions[" apple" ] = R"cmake( APPLE)cmake" ;
279+ conditions[" bsd" ] = R"cmake( BSD)cmake" ;
280+ conditions[" cygwin" ] = R"cmake( CYGWIN)cmake" ;
281+ conditions[" ios" ] = R"cmake( IOS)cmake" ;
282+ conditions[" xcode" ] = R"cmake( XCODE)cmake" ;
283+ conditions[" wince" ] = R"cmake( WINCE)cmake" ;
277284 } else {
278285 conditions = parent->conditions ;
279286 templates = parent->templates ;
@@ -432,6 +439,9 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
432439 }
433440 options.push_back (o);
434441
442+ // Add a condition matching the option name
443+ conditions.emplace (o.name , o.name );
444+
435445 // Add an implicit condition for the option
436446 auto ncondition = normalize (o.name );
437447 if (ncondition.find (nproject_prefix) == 0 ) {
@@ -870,9 +880,8 @@ bool Project::cmake_minimum_version(int major, int minor) const {
870880}
871881
872882bool Project::is_condition_name (const std::string &name) {
873- auto is_named_condition = true ;
874883 for (auto ch : name) {
875- if (!(ch == ' - ' || (ch >= ' 0 ' && ch < = ' 9 ' ) || (ch >= ' a ' && ch < = ' z ' )) ) {
884+ if (!std::isalnum (ch) && ch ! = ' - ' && ch ! = ' _ ' ) {
876885 return false ;
877886 }
878887 }
0 commit comments