reflect gen code in new CMakeLists.txt

self-hosting
MoAlyousef 4 years ago
parent b016d7139c
commit 41b00b4f98

@ -1,5 +1,12 @@
# This file was generated automatically by cmkr. # This file was generated automatically by cmkr.
# Regenerate CMakeLists.txt file when necessary
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT)
cmkr()
endif()
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.15)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

@ -113,7 +113,7 @@ int generate_cmake(const char *path) {
ss << "\n"; ss << "\n";
ss << "# Regenerate CMakeLists.txt file when necessary\n"; ss << "# Regenerate CMakeLists.txt file when necessary\n";
ss << "include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)\n"; ss << "include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)\n\n";
ss << "if(CMKR_INCLUDE_RESULT)\n"; ss << "if(CMKR_INCLUDE_RESULT)\n";
ss << "\tcmkr()\n"; ss << "\tcmkr()\n";
ss << "endif()\n"; ss << "endif()\n";
@ -225,12 +225,17 @@ int generate_cmake(const char *path) {
} else { } else {
set_val = std::get<bool>(set.val) ? "ON" : "OFF"; set_val = std::get<bool>(set.val) ? "ON" : "OFF";
} }
ss << "set(" << set.name << " " << set_val;; ss << "set(" << set.name << " " << set_val;
;
if (set.cache) { if (set.cache) {
std::string typ; std::string typ;
if (set.val.index() == 1) typ = "STRING"; else typ = "BOOL"; if (set.val.index() == 1)
typ = "STRING";
else
typ = "BOOL";
ss << " CACHE " << typ << " \"" << set.comment << "\""; ss << " CACHE " << typ << " \"" << set.comment << "\"";
if (set.force) ss << " FORCE"; if (set.force)
ss << " FORCE";
} }
ss << ")\n\n"; ss << ")\n\n";
} }
@ -364,7 +369,11 @@ int generate_cmake(const char *path) {
ss << conf << " "; ss << conf << " ";
} }
} }
ss << "\n\tDESTINATION " << inst.destination << "\n\t)\n\n"; ss << "\n\tDESTINATION " << inst.destination << "\n\t";
if (!inst.targets.empty())
ss << "COMPONENT " << inst.targets[0] << "\n\t)\n\n";
else
ss << "\n\t)\n\n";
} }
} }

Loading…
Cancel
Save