Merge branch 'bootstrapper-upgrade'

toml-checker
Duncan Ogilvie 4 years ago
commit 3b4bc919a1

@ -31,7 +31,7 @@ project(cmkr
LANGUAGES LANGUAGES
CXX CXX
VERSION VERSION
0.1.3 0.1.4
DESCRIPTION DESCRIPTION
"CMakeLists generator from TOML" "CMakeLists generator from TOML"
) )

@ -1,27 +1,44 @@
# This file was generated automatically by cmkr. # This file was generated automatically by cmkr.
# Regenerate CMakeLists.txt file when necessary cmake_minimum_required(VERSION 3.15)
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
# Regenerate CMakeLists.txt automatically in the root project
set(CMKR_ROOT_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMKR_ROOT_PROJECT ON)
# Bootstrap cmkr
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT) if(CMKR_INCLUDE_RESULT)
cmkr() cmkr()
endif() endif()
cmake_minimum_required(VERSION 3.15) # Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
set(example_PROJECT_VERSION 0.1.0) # Create a configure-time dependency on cmake.toml to improve IDE support
project(example VERSION ${example_PROJECT_VERSION}) if(CMKR_ROOT_PROJECT)
configure_file(cmake.toml cmake.toml COPYONLY)
endif()
set(EXAMPLE_SOURCES project(example
src/example.cpp VERSION
cmake.toml 0.1.0
) )
add_executable(example ${EXAMPLE_SOURCES}) # Target example
set(example_SOURCES
"src/example.cpp"
cmake.toml
)
source_group(TREE ${PROJECT_SOURCE_DIR} FILES ${EXAMPLE_SOURCES}) add_executable(example ${example_SOURCES})
get_directory_property(CMKR_VS_STARTUP_PROJECT DIRECTORY ${PROJECT_SOURCE_DIR} DEFINITION VS_STARTUP_PROJECT)
if(NOT CMKR_VS_STARTUP_PROJECT)
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT example)
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${example_SOURCES})

@ -1,13 +1,12 @@
# This is a minimal example project used for testing the cmkr bootstrapping process # This is a minimal example project used for testing the cmkr bootstrapping process
[cmake] [cmake]
minimum = "3.15" version = "3.15"
[project] [project]
name = "example" name = "example"
version = "0.1.0" version = "0.1.0"
[[target]] [target.example]
name = "example"
type = "executable" type = "executable"
sources = ["src/example.cpp"] sources = ["src/example.cpp"]

@ -1,8 +1,10 @@
include_guard() include_guard()
# Change these defaults to point to your infrastructure if desired # Change these defaults to point to your infrastructure if desired
set(CMKR_REPO "https://github.com/MoAlyousef/cmkr" CACHE STRING "cmkr git repository") set(CMKR_REPO "https://github.com/MoAlyousef/cmkr" CACHE STRING "cmkr git repository" FORCE)
set(CMKR_TAG "archive_84f6b39f" CACHE STRING "cmkr git tag (this needs to be available forever)") set(CMKR_TAG "archive_7b7b2603" CACHE STRING "cmkr git tag (this needs to be available forever)" FORCE)
# Set these from the command line to customize for development/debugging purposes
set(CMKR_EXECUTABLE "" CACHE FILEPATH "cmkr executable") set(CMKR_EXECUTABLE "" CACHE FILEPATH "cmkr executable")
set(CMKR_SKIP_GENERATION OFF CACHE BOOL "skip automatic cmkr generation") set(CMKR_SKIP_GENERATION OFF CACHE BOOL "skip automatic cmkr generation")
@ -45,7 +47,14 @@ else()
endif() endif()
# Use cached cmkr if found # Use cached cmkr if found
set(CMKR_CACHED_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/_cmkr/bin/${CMKR_EXECUTABLE_NAME}") set(CMKR_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_cmkr_${CMKR_TAG}")
set(CMKR_CACHED_EXECUTABLE "${CMKR_DIRECTORY}/bin/${CMKR_EXECUTABLE_NAME}")
if(NOT CMKR_CACHED_EXECUTABLE STREQUAL CMKR_EXECUTABLE AND CMKR_EXECUTABLE MATCHES "^${CMAKE_CURRENT_BINARY_DIR}/_cmkr")
message(AUTHOR_WARNING "[cmkr] Upgrading '${CMKR_EXECUTABLE}' to '${CMKR_CACHED_EXECUTABLE}'")
unset(CMKR_EXECUTABLE CACHE)
endif()
if(CMKR_EXECUTABLE AND EXISTS "${CMKR_EXECUTABLE}") if(CMKR_EXECUTABLE AND EXISTS "${CMKR_EXECUTABLE}")
message(VERBOSE "[cmkr] Found cmkr: '${CMKR_EXECUTABLE}'") message(VERBOSE "[cmkr] Found cmkr: '${CMKR_EXECUTABLE}'")
elseif(CMKR_EXECUTABLE AND NOT CMKR_EXECUTABLE STREQUAL CMKR_CACHED_EXECUTABLE) elseif(CMKR_EXECUTABLE AND NOT CMKR_EXECUTABLE STREQUAL CMKR_CACHED_EXECUTABLE)
@ -55,7 +64,6 @@ else()
message(VERBOSE "[cmkr] Bootstrapping '${CMKR_EXECUTABLE}'") message(VERBOSE "[cmkr] Bootstrapping '${CMKR_EXECUTABLE}'")
message(STATUS "[cmkr] Fetching cmkr...") message(STATUS "[cmkr] Fetching cmkr...")
set(CMKR_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_cmkr")
if(EXISTS "${CMKR_DIRECTORY}") if(EXISTS "${CMKR_DIRECTORY}")
cmkr_exec("${CMAKE_COMMAND}" -E rm -rf "${CMKR_DIRECTORY}") cmkr_exec("${CMAKE_COMMAND}" -E rm -rf "${CMKR_DIRECTORY}")
endif() endif()

@ -337,7 +337,7 @@ int generate_cmake(const char *path, bool root) {
}; };
// TODO: add link with proper documentation // TODO: add link with proper documentation
comment("This file was generated automatically by cmkr.").endl(); comment("This file is automatically generated from cmake.toml - DO NOT EDIT").endl();
cmake::CMake cmake(path, false); cmake::CMake cmake(path, false);

Loading…
Cancel
Save