@@ -220,7 +220,7 @@ void set_target_properties(Context &ctx, const String &name, const String &prope
220220
221221void set_target_properties (Context &ctx, const String &property, const String &value)
222222{
223- ctx. addLine ( " set_target_properties(${this} PROPERTIES " + property + " " + value + " ) " );
223+ set_target_properties (ctx, " ${this}" , property, value);
224224}
225225
226226void declare_dummy_target (Context &ctx, const String &name)
@@ -273,6 +273,16 @@ String prepare_include_directory(const String &i)
273273 return " ${SDIR}/" + i;
274274};
275275
276+ void print_sdir_bdir (Context &ctx, const Package &d)
277+ {
278+ if (d.flags [pfLocalProject])
279+ ctx.addLine (" set(SDIR " + normalize_path (rd[d].config ->getDefaultProject ().root_directory ) + " )" );
280+ else
281+ ctx.addLine (" set(SDIR ${CMAKE_CURRENT_SOURCE_DIR})" );
282+ ctx.addLine (" set(BDIR ${CMAKE_CURRENT_BINARY_DIR})" );
283+ ctx.emptyLines ();
284+ }
285+
276286String get_binary_path (const Package &d, const String &prefix)
277287{
278288 return prefix + " /cppan/" + d.getHashShort ();
@@ -474,9 +484,13 @@ void print_build_dependencies(Context &ctx, const Package &d, const String &targ
474484 }
475485 local.emptyLines ();
476486
487+ bool deps = false ;
477488 String build_deps_tgt = " ${this}" ;
478489 if (d.empty () && target.find (" -b" ) != target.npos )
490+ {
479491 build_deps_tgt += " -d" ; // deps
492+ deps = true ;
493+ }
480494 else
481495 build_deps_tgt += " -b-d" ;
482496
@@ -539,6 +553,10 @@ void print_build_dependencies(Context &ctx, const Package &d, const String &targ
539553 local.addLine (" )" );
540554 local.addLine (" add_dependencies(${this} " + build_deps_tgt + " )" );
541555 print_solution_folder (local, build_deps_tgt, service_folder);
556+ if (deps)
557+ set_target_properties (local, build_deps_tgt, " PROJECT_LABEL" , " dependencies" );
558+ else
559+ set_target_properties (local, build_deps_tgt, " PROJECT_LABEL" , (d.flags [pfLocalProject] ? d.ppath .back () : d.target_name ) + " -build-dependencies" );
542560 local.addLine ();
543561
544562 if (has_build_deps)
@@ -1137,12 +1155,7 @@ void CMakePrinter::print_src_config_file(const path &fn) const
11371155 ctx.addLine (" set(EXECUTABLE " + String (d.flags [pfExecutable] ? " 1" : " 0" ) + " )" );
11381156 ctx.addLine ();
11391157
1140- if (d.flags [pfLocalProject])
1141- ctx.addLine (" set(SDIR " + normalize_path (p.root_directory ) + " )" );
1142- else
1143- ctx.addLine (" set(SDIR ${CMAKE_CURRENT_SOURCE_DIR})" );
1144- ctx.addLine (" set(BDIR ${CMAKE_CURRENT_BINARY_DIR})" );
1145- ctx.addLine ();
1158+ print_sdir_bdir (ctx, d);
11461159
11471160 ctx.addLine (" set(LIBRARY_API " + library_api (d) + " )" );
11481161 ctx.addLine ();
@@ -1329,10 +1342,7 @@ endif()
13291342 if (!d.flags [pfHeaderOnly])
13301343 {
13311344 set_target_properties (ctx, " OUTPUT_NAME" , d.target_name );
1332- if (d.flags [pfLocalProject])
1333- set_target_properties (ctx, " PROJECT_LABEL" , d.ppath .back ());
1334- else
1335- set_target_properties (ctx, " PROJECT_LABEL" , d.target_name );
1345+ set_target_properties (ctx, " PROJECT_LABEL" , d.flags [pfLocalProject] ? d.ppath .back () : d.target_name );
13361346 ctx.emptyLines ();
13371347 }
13381348 }
@@ -1681,9 +1691,9 @@ target_compile_options(${this}
16811691)
16821692endif()
16831693
1684- if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
1694+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" )
16851695target_compile_options(${this}
1686- PRIVATE -Wmacro -redefined
1696+ PRIVATE -Wno-macro -redefined
16871697)
16881698endif()
16891699)" );
@@ -1893,9 +1903,7 @@ void CMakePrinter::print_src_actions_file(const path &fn) const
18931903 ctx.addLine (" set(CMAKE_CURRENT_BINARY_DIR_OLD ${CMAKE_CURRENT_BINARY_DIR})" );
18941904 ctx.addLine (" set(CMAKE_CURRENT_BINARY_DIR \" " + normalize_path (get_binary_path (d)) + " \" )" );
18951905 ctx.addLine ();
1896- ctx.addLine (" set(SDIR ${CMAKE_CURRENT_SOURCE_DIR})" );
1897- ctx.addLine (" set(BDIR ${CMAKE_CURRENT_BINARY_DIR})" );
1898- ctx.addLine ();
1906+ print_sdir_bdir (ctx, d);
18991907 ctx.addLine (" set(LIBRARY_API " + library_api (d) + " )" );
19001908 ctx.addLine ();
19011909 print_bs_insertion (ctx, p, " pre sources" , &BuildSystemConfigInsertions::pre_sources);
@@ -2315,17 +2323,19 @@ void CMakePrinter::print_meta_config_file(const path &fn) const
23152323 // re-run cppan when root cppan.yml is changed
23162324 if (settings.add_run_cppan_target )
23172325 {
2326+ print_sdir_bdir (ctx, d);
2327+
23182328 config_section_title (ctx, " cppan regenerator" );
23192329 ctx.addLine (R"( set(file ${CMAKE_CURRENT_BINARY_DIR}/run-cppan.txt)
23202330add_custom_command(OUTPUT ${file}
23212331 COMMAND ${CPPAN_COMMAND} -d ${PROJECT_SOURCE_DIR}
23222332 COMMAND ${CMAKE_COMMAND} -E echo "" > ${file}
2323- DEPENDS ${PROJECT_SOURCE_DIR }/cppan.yml
2333+ DEPENDS ${SDIR }/cppan.yml
23242334)
23252335add_custom_target(run-cppan
23262336 DEPENDS ${file}
23272337 SOURCES
2328- ${PROJECT_SOURCE_DIR }/cppan.yml
2338+ ${SDIR }/cppan.yml
23292339 \")" + normalize_path (directories.get_static_files_dir () / cmake_functions_filename) + R"( \"
23302340 ${PROJECT_SOURCE_DIR}/cppan/)" + cmake_helpers_filename + R"(
23312341)
@@ -2614,7 +2624,11 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON))");
26142624 if (d.empty ())
26152625 {
26162626 declare_dummy_target (ctx, cppan_dummy_build_target);
2627+ set_target_properties (ctx, cppan_dummy_target (cppan_dummy_build_target), " PROJECT_LABEL" , " build-dependencies" );
2628+
26172629 declare_dummy_target (ctx, cppan_dummy_copy_target);
2630+ set_target_properties (ctx, cppan_dummy_target (cppan_dummy_copy_target), " PROJECT_LABEL" , " copy-dependencies" );
2631+
26182632 ctx.addLine (" add_dependencies(" + cppan_dummy_target (cppan_dummy_copy_target) + " " + cppan_dummy_target (cppan_dummy_build_target) + " )" );
26192633 }
26202634
@@ -2713,14 +2727,23 @@ void CMakePrinter::parallel_vars_check(const ParallelCheckOptions &o) const
27132727 if (!o.toolchain .empty ())
27142728 args.push_back (" -DCMAKE_TOOLCHAIN_FILE=" + o.toolchain );
27152729
2730+ //
2731+ command::Result ret;
27162732 auto print = [](const String &s)
27172733 {
27182734 LOG_INFO (logger, s);
27192735 };
27202736 command::Options o;
27212737 o.out .action = print;
27222738 o.err .action = print;
2723- auto ret = command::execute_and_capture (args, o);
2739+
2740+ #ifndef _WIN32
2741+ // hide output for *nix as it very fast there
2742+ if (N >= 4 )
2743+ ret = command::execute (args);
2744+ else
2745+ #endif
2746+ ret = command::execute_and_capture (args, o);
27242747
27252748 // do not fail (throw), try to read already found variables
27262749 if (ret.rc )
0 commit comments