Skip to content

Commit

Permalink
Merge pull request #6 from jchristopherson/v1.0.3
Browse files Browse the repository at this point in the history
V1.0.3
  • Loading branch information
jchristopherson committed Feb 28, 2024
2 parents 775d0e9 + ee7f9bf commit db4540b
Show file tree
Hide file tree
Showing 24 changed files with 237 additions and 217 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CMake

on:
push:
branches: [ "main" ]
branches: [ "master" ]
pull_request:
branches: [ "main" ]
branches: [ "master" ]

env:
BUILD_TYPE: Release
Expand Down
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.24)
project(
collections
LANGUAGES Fortran
VERSION 1.0.2
VERSION 1.0.3
)

# Utilize the GNU installation structure
Expand All @@ -15,7 +15,6 @@ include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
add_subdirectory(configure)

# Deal with dependencies
find_package(ferror 1.4.2 QUIET)
add_subdirectory(dependencies)

# Source
Expand All @@ -30,9 +29,6 @@ add_fortran_library(
)
link_library(${PROJECT_NAME} ${ferror_LIBRARY} ${ferror_INCLUDE_DIR})

# Installation
add_subdirectory(install)

# Testing
option(BUILD_TESTING "Build tests")
include(CTest)
Expand Down
4 changes: 0 additions & 4 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Get the macros and functions we'll need
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
include(FetchContent)

# Get FERROR
add_subdirectory(ferror)
set(ferror_LIBRARY ${ferror_LIBRARY} PARENT_SCOPE)
Expand Down
52 changes: 13 additions & 39 deletions dependencies/ferror/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,18 @@
# Get the macros and functions we'll need
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
include(FetchContent)

# If found, us the installed version; else, import the library
if (ferror_FOUND)
# Inform the user of what's going on
message(STATUS "FERROR (${ferror_VERSION}) library found.")
# Fetch the proper content
FetchContent_Declare(
ferror
GIT_REPOSITORY "https://github.com/jchristopherson/ferror"
)
FetchContent_MakeAvailable(ferror)

# Get the mod file location
get_target_property(ferror_INCLUDE_DIR ferror INTERFACE_INCLUDE_DIRECTORIES)
else()
# Inform the user of what's going on
message(STATUS "FERROR library not found. Downloading appropriate repository.")

# Fetch the proper content
FetchContent_Declare(
ferror
GIT_REPOSITORY "https://github.com/jchristopherson/ferror"
OVERRIDE_FIND_PACKAGE
)

FetchContent_MakeAvailable(ferror)

if (WIN32)
if (BUILD_SHARED_LIBS)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:ferror>
$<TARGET_FILE_DIR:${PROJECT_NAME}
)
endif()
endif()

set(ferror_INCLUDE_DIR ${ferror_BINARY_DIR}/include)
endif()

# Make a parent-scope variable for the library
set(ferror_INCLUDE_DIR ${ferror_BINARY_DIR}/include)
configure_file(
"${ferror_SOURCE_DIR}/include/ferror.h"
"${ferror_INCLUDE_DIR}/ferror.h"
COPYONLY
)
set(ferror_LIBRARY ferror)
set(ferror_INCLUDE_DIR ${ferror_INCLUDE_DIR} PARENT_SCOPE)
set(ferror_LIBRARY ${ferror_LIBRARY} PARENT_SCOPE)

# Make a parent-scope variable locating the include directory for ferror
set(ferror_INCLUDE_DIR ${ferror_INCLUDE_DIR} PARENT_SCOPE)
Loading

0 comments on commit db4540b

Please sign in to comment.