From 4c2a5cd9ef642e714e035a56d812e226885e39a5 Mon Sep 17 00:00:00 2001
From: Oliver Heidmann <oliver.heidmann@mpimet.mpg.de>
Date: Mon, 3 Mar 2025 15:15:18 +0100
Subject: [PATCH] CMake: fixed typo, moved library declaration to main CMake
 file, added compile commands

---
 CMakeLists.txt     | 6 +++++-
 src/CMakeLists.txt | 4 ----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 015d24df8..fd2272523 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,12 @@
 cmake_minimum_required( VERSION 3.27 FATAL_ERROR )
 
-message(VERBOSE "Entering libcdi")
+message(VERBOSE "Entering cdilib")
 project(cdilib VERSION 2.5.1 LANGUAGES C )
 set(CMAKE_C_STANDARD 11)
+set(CMAKE_EXPORT_COMPILE_COMMANDS YES)
+
+add_library(cdilib)
+add_library(cdilib::cdilib ALIAS cdilib)
 
 include(CTest)
 include(CheckIncludeFile)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 26ea963f1..250f7a928 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -199,16 +199,12 @@ endif ()
 # Support exporting all symbolds on Windows
 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
 
-add_library(cdilib
-  ${cdi_src_files}
-#  INSTALL_HEADERS_LIST  cdi.h
 )
 
 target_include_directories(cdilib PRIVATE "${PROJECT_BINARY_DIR}/src/config.h")
 target_link_libraries(cdilib ${cdi_linked_libs})
 target_compile_definitions(cdilib PRIVATE PACKAGE_NAME="${PROJECT_NAME}" VERSION="${CMAKE_PROJECT_VERSION}" ${cdi_compile_defs})
 
-add_library(cdilib::cdilib ALIAS cdilib)
 
 include(GNUInstallDirs)
 install(FILES cdi.h calendar.h cdi_datetime.h julian_date.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
-- 
GitLab