mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 06:37:43 -05:00
Adding PATCHES keyword. (#558)
* Adding PATCHES keyword. * Formatting fix. * Move cpm_add_patches() outside if/else scopes. * cmake-format: add PATCHES to CPMAddPackage. * Integration tests for PATCHES command. * Use get_filename_component() in place of cmake_path() for use with all cmake versions 3.14 and above. * Added an example and improved comment for cpm_add_patches.
This commit is contained in:
13
test/integration/templates/using-patch-adder/lists.in.cmake
Normal file
13
test/integration/templates/using-patch-adder/lists.in.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
||||
|
||||
project(using-patch-adder)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
include("%{cpm_path}")
|
||||
|
||||
%{packages}
|
||||
|
||||
add_executable(using-patch-adder using-patch-adder.cpp)
|
||||
|
||||
target_link_libraries(using-patch-adder adder)
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/code/adder/adder.hpp b/code/adder/adder.hpp
|
||||
index fdb9324..7c2fa00 100644
|
||||
--- a/code/adder/adder.hpp
|
||||
+++ b/code/adder/adder.hpp
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
-namespace adder
|
||||
+namespace patched
|
||||
{
|
||||
int add(int a, int b);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/code/adder/adder.cpp b/code/adder/adder.cpp
|
||||
index fc6e767..44b1197 100644
|
||||
--- a/code/adder/adder.cpp
|
||||
+++ b/code/adder/adder.cpp
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "adder.hpp"
|
||||
|
||||
-namespace adder
|
||||
+namespace patched
|
||||
{
|
||||
int add(int a, int b)
|
||||
{
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <adder/adder.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
int main() {
|
||||
int sum = patched::add(5, 3);
|
||||
std::printf("%d\n", sum);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user