From 0f78573977d9011f35ab717ab6c158f956690f98 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Thu, 19 Oct 2023 13:56:27 -0600 Subject: [PATCH 1/3] Update minimum version to remove deprecation warning --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7c5f3f..e5bbabe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.12) project(bmic C) From 1185ae0c0f71a91907e23d5d0651b8155d8361aa Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Thu, 19 Oct 2023 14:14:18 -0600 Subject: [PATCH 2/3] Use GNUInstallDirs and standard install variables --- CMakeLists.txt | 7 ++++--- bmic.pc.cmake | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5bbabe..4adecc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,18 @@ cmake_minimum_required(VERSION 3.12) -project(bmic C) +project(bmic LANGUAGES C) set(BMI_VERSION 2.0) +include(GNUInstallDirs) configure_file(${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pc.cmake ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc) install( FILES bmi.h - DESTINATION include + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install( FILES ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc - DESTINATION lib/pkgconfig + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) diff --git a/bmic.pc.cmake b/bmic.pc.cmake index e1dc386..1eca94c 100644 --- a/bmic.pc.cmake +++ b/bmic.pc.cmake @@ -1,5 +1,5 @@ Name: Bmi Description: The Basic Model Interface Version: ${BMI_VERSION} -Libs: -L${CMAKE_INSTALL_PREFIX}/lib -lbmic -Cflags: -I${CMAKE_INSTALL_PREFIX}/include +Libs: -L${CMAKE_INSTALL_LIBDIR} -lbmic +Cflags: -I${CMAKE_INSTALL_INCLUDEDIR} From 78ed7116360402beb7afc94dd17a5371c085fb54 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Thu, 19 Oct 2023 14:18:59 -0600 Subject: [PATCH 3/3] Update build instructions for a conda environment --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 98ba6ba..8c766f3 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ into an Anaconda distribution with ### Linux and macOS -To install the C BMI bindings from source with cmake, run +To install the C BMI bindings from source with CMake, run mkdir _build && cd _build cmake .. -DCMAKE_INSTALL_PREFIX= @@ -36,6 +36,8 @@ To install the C BMI bindings from source with cmake, run where `` is the base directory in which to install the bindings (`/usr/local` is the default). +When using a conda environment, +use the `$CONDA_PREFIX` environment variable. The installation will look like: @@ -54,7 +56,7 @@ An additional prerequisite is needed for Windows: * Microsoft Visual Studio 2017 or Microsoft Build Tools for Visual Studio 2017 -To configure and install the C BMI bindings from source with cmake, +To configure and install the C BMI bindings from source with CMake, run the following in a [Developer Command Prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs) mkdir _build && cd _build @@ -64,10 +66,10 @@ run the following in a [Developer Command Prompt](https://docs.microsoft.com/en- -DCMAKE_BUILD_TYPE=Release cmake --build . --target install --config Release -where `` is the base directory -in which to install the bindings (`"C:\Program Files (x86)"` is the default; -note that quotes and an absolute path are needed). - +where `` is the base directory in which to install the bindings. +The default is `"C:\Program Files (x86)"`. +Note that quotes and an absolute path are needed. +When using a conda environment, use `"%CONDA_PREFIX%\Library"`. ## Use