File tree Expand file tree Collapse file tree 5 files changed +18
-11
lines changed Expand file tree Collapse file tree 5 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,16 @@ include_guard()
22
33# Change these defaults to point to your infrastructure if desired
44set (CMKR_REPO "https://github.com/build-cpp/cmkr" CACHE STRING "cmkr git repository" FORCE)
5- set (CMKR_TAG "archive_9e1fa5dc " CACHE STRING "cmkr git tag (this needs to be available forever)" FORCE)
5+ set (CMKR_TAG "archive_a718dfd6 " CACHE STRING "cmkr git tag (this needs to be available forever)" FORCE)
66
77# Set these from the command line to customize for development/debugging purposes
88set (CMKR_EXECUTABLE "" CACHE FILEPATH "cmkr executable" )
99set (CMKR_SKIP_GENERATION OFF CACHE BOOL "skip automatic cmkr generation" )
1010
1111# Disable cmkr if generation is disabled
12- if (DEFINED ENV{CI} OR CMKR_SKIP_GENERATION)
12+ if (DEFINED ENV{CI} OR CMKR_SKIP_GENERATION OR CMKR_BUILD_SKIP_GENERATION )
1313 message (STATUS "[cmkr] Skipping automatic cmkr generation" )
14+ unset (CMKR_BUILD_SKIP_GENERATION CACHE )
1415 macro (cmkr)
1516 endmacro ()
1617 return ()
Original file line number Diff line number Diff line change @@ -7,13 +7,12 @@ function(generate_resources target)
77 foreach (SOURCE ${TARGET_SOURCES} )
88 if (SOURCE MATCHES ".cmake$" )
99 get_filename_component (RESOURCE_NAME "${SOURCE} " NAME_WE )
10- set (RESOURCE_HEADER "include/resources/${RESOURCE_NAME} .h" )
11- configure_file ("${SOURCE} " "${CMAKE_CURRENT_BINARY_DIR} /${RESOURCE_HEADER} " )
12- file (READ "${CMAKE_CURRENT_BINARY_DIR} /${RESOURCE_HEADER} " RESOURCE_CONTENTS)
13- file (GENERATE
14- OUTPUT "${CMAKE_CURRENT_BINARY_DIR} /${RESOURCE_HEADER} "
15- CONTENT "namespace cmkr {\n namespace resources {\n static const char* ${RESOURCE_NAME} = R\" RESOURCE(${RESOURCE_CONTENTS} )RESOURCE\" ;\n }\n }"
16- )
10+ set (RESOURCE_HEADER "include/resources/${RESOURCE_NAME} .hpp" )
11+ # Add configure-time dependency on the source file
12+ configure_file ("${SOURCE} " "${RESOURCE_HEADER} " COPYONLY )
13+ # Generate the actual resource into the header
14+ file (READ "${SOURCE} " RESOURCE_CONTENTS)
15+ configure_file ("${PROJECT_SOURCE_DIR} /cmake/resource.hpp.in" "${RESOURCE_HEADER} " @ONLY)
1716 message (STATUS "[cmkr] Generated ${RESOURCE_HEADER} " )
1817 endif ()
1918 endforeach ()
Original file line number Diff line number Diff line change 1+ namespace cmkr {
2+ namespace resources {
3+
4+ static const char* @RESOURCE_NAME@ = R"RESOURCE(@RESOURCE_CONTENTS@)RESOURCE";
5+
6+ }
7+ }
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ int run(int argc, char **argv) {
2525 if (gen::generate_cmake (fs::current_path ().string ().c_str ()))
2626 throw std::runtime_error (" CMake generation failure!" );
2727
28- ss << " cmake -S. -DCMKR_SKIP_GENERATION =ON -B" << project.build_dir << " " ;
28+ ss << " cmake -S. -DCMKR_BUILD_SKIP_GENERATION =ON -B" << project.build_dir << " " ;
2929
3030 if (!project.generator .empty ()) {
3131 ss << " -G \" " << project.generator << " \" " ;
Original file line number Diff line number Diff line change 11#include " cmake_generator.hpp"
22#include " error.hpp"
33#include " literals.hpp"
4- #include < resources/cmkr.h >
4+ #include < resources/cmkr.hpp >
55
66#include " fs.hpp"
77#include < cassert>
You can’t perform that action at this time.
0 commit comments