@@ -1358,6 +1358,9 @@ int CMakePrinter::generate(const BuildSettings &bs) const
13581358 {
13591359 c.args .push_back (" -G" );
13601360 c.args .push_back (s.generator );
1361+
1362+ // if (s.generator.find("Win64") != s.generator.npos)
1363+ // c.args.push_back("-Thost=x64");
13611364 }
13621365 if (!s.system_version .empty ())
13631366 c.args .push_back (" -DCMAKE_SYSTEM_VERSION=" + s.system_version );
@@ -1656,10 +1659,19 @@ void CMakePrinter::print_settings(CMakeContext &ctx) const
16561659 ctx.addLine (" set(PACKAGE_BUGREPORT)" );
16571660 ctx.addLine ();
16581661
1662+ // returns 0x010203
16591663 auto n2hex = [](int n, int w)
16601664 {
16611665 std::ostringstream ss;
1662- ss << std::hex << std::setfill (' 0' ) << std::setw (w) << n;
1666+ ss << n / 10 << n % 10 ;
1667+ return ss.str ();
1668+ };
1669+
1670+ // returns 0x000100020003
1671+ auto n4hex = [](int n, int w)
1672+ {
1673+ std::ostringstream ss;
1674+ ss << n / 1000 << n / 100 << n / 10 << n % 10 ;
16631675 return ss.str ();
16641676 };
16651677
@@ -1670,17 +1682,17 @@ void CMakePrinter::print_settings(CMakeContext &ctx) const
16701682 }
16711683 else
16721684 {
1673- auto ver2hex = [this , &n2hex ](int n)
1685+ auto ver2hex = [this ](int n, auto f )
16741686 {
16751687 std::ostringstream ss;
1676- ss << n2hex (d.version .major , n);
1677- ss << n2hex (d.version .minor , n);
1678- ss << n2hex (d.version .patch , n);
1688+ ss << f (d.version .major , n);
1689+ ss << f (d.version .minor , n);
1690+ ss << f (d.version .patch , n);
16791691 return ss.str ();
16801692 };
16811693
1682- ctx.addLine (" set(PACKAGE_VERSION_NUM \" 0x" + ver2hex (2 ) + " \" )" );
1683- ctx.addLine (" set(PACKAGE_VERSION_NUM2 \" 0x" + ver2hex (4 ) + " LL\" )" );
1694+ ctx.addLine (" set(PACKAGE_VERSION_NUM \" 0x" + ver2hex (2 , n2hex ) + " \" )" );
1695+ ctx.addLine (" set(PACKAGE_VERSION_NUM2 \" 0x" + ver2hex (4 , n4hex ) + " LL\" )" );
16841696 }
16851697 ctx.addLine ();
16861698
@@ -1777,11 +1789,14 @@ void CMakePrinter::print_settings(CMakeContext &ctx) const
17771789 ctx.addLine ();
17781790
17791791 // copy exe cmake settings
1780- ctx.if_ (" EXECUTABLE AND CPPAN_USE_CACHE" );
1792+ ctx.if_ (" EXECUTABLE AND CPPAN_USE_CACHE AND NOT CPPAN_LOCAL_PROJECT " );
17811793 ctx.addLine (" set(to \" " + normalize_path (directories.storage_dir_cfg ) + " /${config}/CMakeFiles/${CMAKE_VERSION}\" )" );
1794+ ctx.addLine (" set(from \" ${PROJECT_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}\" )" );
1795+ // probably this is incorrect because from dir must be there always
1796+ // ctx.if_("NOT EXISTS ${to} AND EXISTS ${from}");
17821797 ctx.if_ (" NOT EXISTS ${to}" );
17831798 ctx.addLine (" execute_process(" );
1784- ctx.addLine (" COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION } ${to}" );
1799+ ctx.addLine (" COMMAND ${CMAKE_COMMAND} -E copy_directory ${from } ${to}" );
17851800 ctx.addLine (" RESULT_VARIABLE ret" );
17861801 ctx.addLine (" )" );
17871802 ctx.endif ();
0 commit comments