Skip to content

Commit 90f6109

Browse files
committed
Clean up install logic
Problem ------- Using the parameters to describe the project in `project()` is misleading. It happens to be that the name `beman.exemplar` is used as the name of the project and as the CMake export name, but those are two different concepts that do not necessarily align. Also, the variable dereferencing in CMakeLists.txt is no less error prone than typing beman.exemplar. That's because it is not difficult to type things like ${PROJET_SOURCE_DIR}, which CMake will expand to an empty string. Instead, the readability of the install logic improves because it looks like a file with a specific name is being specifically created and referenced, which is the intention of the relevant installation logic. Solution -------- * Remove references to PROJECT_NAME, PROJECT_SOURCE_DIR, and PROJECT_BINARY_DIR. Prefer relative paths to CMAKE_CURRENT_SOUCE_DIR and CMAKE_CURRENT_BINARY_DIR instead. * Rename the install COMPONENT for beman.exemplar to "beman.exemplar" instead of "development". * Add the install COMPONENT to the installation of the beman.exemplar library target itself. * Move FetchContent include to use-fetch-content.cmake.
1 parent 1144f5e commit 90f6109

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

cmake/beman.exemplar-config.cmake.in

Lines changed: 0 additions & 7 deletions
This file was deleted.

cmake/use-fetch-content.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
cmake_minimum_required(VERSION 3.24)
22

3+
include(FetchContent)
4+
35
if(NOT BEMAN_EXEMPLAR_LOCKFILE)
46
set(BEMAN_EXEMPLAR_LOCKFILE
57
"lockfile.json"

0 commit comments

Comments
 (0)