Skip to content

Commit 6f06b12

Browse files
committed
fable: Update examples to use modern CMake
1 parent 1230015 commit 6f06b12

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

fable/examples/contacts/Makefile

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@ BUILD_DIR := build
77
# The build type must be synchronized between Conan (host build type)
88
# and CMake, otherwise you will get strange and unhelpful errors.
99
BUILD_TYPE := Release
10+
CMAKE_BUILD_TYPE := $(shell echo ${BUILD_TYPE} | tr '[:upper:]' '[:lower:]')
1011

1112
# This is the output that Conan generates when using
1213
# `CMakeToolchain` generator AND the `cmake_layout` layout.
13-
TOOLCHAIN_FILE := ${BUILD_DIR}/generators/conan_toolchain.cmake
14+
TOOLCHAIN_FILE := ${BUILD_DIR}/${BUILD_TYPE}/generators/conan_toolchain.cmake
1415

1516
.PHONY: all clean
1617
all: ${TOOLCHAIN_FILE}
17-
cmake --build ${BUILD_DIR}
18+
cmake --build --preset=${CMAKE_BUILD_TYPE}
1819

1920
${TOOLCHAIN_FILE}:
2021
conan install . --build=missing --install-folder=${BUILD_DIR} -s:h build_type=${BUILD_TYPE}
21-
cmake -B ${BUILD_DIR} -S . \
22-
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
23-
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
24-
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
25-
cmake --build ${BUILD_DIR}
22+
cmake --preset=${CMAKE_BUILD_TYPE} -DCMAKE_EXPORT_COMPILE_COMMANDS=1
2623

2724
clean:
2825
-rm -r ${BUILD_DIR}

fable/examples/simple_config/Makefile

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@ BUILD_DIR := build
77
# The build type must be synchronized between Conan (host build type)
88
# and CMake, otherwise you will get strange and unhelpful errors.
99
BUILD_TYPE := Release
10+
CMAKE_BUILD_TYPE := $(shell echo ${BUILD_TYPE} | tr '[:upper:]' '[:lower:]')
1011

1112
# This is the output that Conan generates when using
1213
# `CMakeToolchain` generator AND the `cmake_layout` layout.
1314
TOOLCHAIN_FILE := ${BUILD_DIR}/generators/conan_toolchain.cmake
1415

1516
.PHONY: all clean
1617
all: ${TOOLCHAIN_FILE}
17-
cmake --build ${BUILD_DIR}
18+
cmake --build --preset=${CMAKE_BUILD_TYPE}
1819

1920
${TOOLCHAIN_FILE}:
2021
conan install . --build=missing --install-folder=${BUILD_DIR} -s:h build_type=${BUILD_TYPE}
21-
cmake -B ${BUILD_DIR} -S . \
22-
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
23-
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
24-
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
25-
cmake --build ${BUILD_DIR}
22+
cmake --preset=${CMAKE_BUILD_TYPE} -DCMAKE_EXPORT_COMPILE_COMMANDS=1
2623

2724
clean:
2825
-rm -r ${BUILD_DIR}

0 commit comments

Comments
 (0)