@@ -1280,9 +1280,9 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
12801280 auto custom_target = target.custom_target ;
12811281 if (tmplate != nullptr ) {
12821282 const auto &custom = tmplate->outline .custom_target ;
1283- if (custom.has_all ) {
1283+ if (!custom_target. has_all && custom.has_all ) {
12841284 custom_target.has_all = true ;
1285- custom_target.all = custom_target. all || custom.all ;
1285+ custom_target.all = custom.all ;
12861286 }
12871287 if (custom.has_command ) {
12881288 custom_target.has_command = true ;
@@ -1336,7 +1336,12 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
13361336 throw_target_error (" job-pool cannot be used with uses-terminal" );
13371337 }
13381338
1339- auto normalize_generated_output_source = [](const std::string &output) {
1339+ auto has_cmake_path_reference = [](const std::string &value) {
1340+ return value.find (" ${" ) != std::string::npos || value.find (" $ENV{" ) != std::string::npos ||
1341+ value.find (" $CACHE{" ) != std::string::npos;
1342+ };
1343+
1344+ auto normalize_generated_output_source = [&has_cmake_path_reference](const std::string &output) {
13401345 auto starts_with = [](const std::string &value, const std::string &prefix) {
13411346 return value.rfind (prefix, 0 ) == 0 ;
13421347 };
@@ -1347,7 +1352,7 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
13471352 starts_with (output, " ${PROJECT_BINARY_DIR}" ) || starts_with (output, " ${CMAKE_CURRENT_SOURCE_DIR}" ) ||
13481353 starts_with (output, " ${CMAKE_SOURCE_DIR}" ) || starts_with (output, " ${PROJECT_SOURCE_DIR}" ) ||
13491354 starts_with (output, " ${CMAKE_CURRENT_LIST_DIR}" ) || starts_with (output, " $ENV{" ) || starts_with (output, " $CACHE{" ) ||
1350- starts_with (output, " ${ " )) {
1355+ has_cmake_path_reference (output)) {
13511356 return output;
13521357 }
13531358 return " ${CMAKE_CURRENT_BINARY_DIR}/" + output;
@@ -1446,8 +1451,7 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
14461451
14471452 // Make sure relative source files exist
14481453 for (const auto &source : sources) {
1449- auto var_index = source.find (" ${" );
1450- if (var_index != std::string::npos)
1454+ if (has_cmake_path_reference (source))
14511455 continue ;
14521456 const auto &source_path = fs::path (path) / source;
14531457 if (!fs::exists (source_path)) {
0 commit comments