Skip to content
Snippets Groups Projects
Verified Commit cd79f745 authored by Tim Kaune's avatar Tim Kaune
Browse files

Differentiate between shared and static for the f2c executable

parent 609399b8
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,12 @@ if (NOT DEFINED NetlibF2C_INSTALL_CMAKEDIR)
CACHE STRING "Path to Netlib LibF2C CMake files")
endif ()
if (BUILD_SHARED_LIBS)
set(type shared)
else ()
set(type static)
endif ()
install(
TARGETS f2c
EXPORT NetlibF2C_Targets-executable
......@@ -33,6 +39,7 @@ install(
install(
EXPORT NetlibF2C_Targets-executable
DESTINATION "${NetlibF2C_INSTALL_CMAKEDIR}"
FILE NetlibF2C_Targets-executable-${type}.cmake
NAMESPACE Netlib::
COMPONENT executable
)
......@@ -41,12 +48,6 @@ target_include_directories(libf2c PUBLIC
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
if (BUILD_SHARED_LIBS)
set(type shared)
else ()
set(type static)
endif ()
install(
TARGETS libf2c libf2cWithFortranMain
EXPORT NetlibF2C_Targets-library
......@@ -93,21 +94,13 @@ write_basic_package_version_file(
COMPATIBILITY SameMajorVersion
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/NetlibF2CConfigVersion.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/NetlibF2CConfig.cmake"
DESTINATION "${NetlibF2C_INSTALL_CMAKEDIR}"
COMPONENT executable
)
if (NOT LoadStaticSharedTargets_FOUND)
set(LoadStaticSharedTargets_DIR "${LoadStaticSharedTargets_INSTALL_CMAKEDIR}")
endif ()
configure_file(
"NetlibF2C_Targets-library.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/NetlibF2C_Targets-library.cmake"
"NetlibF2CConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/NetlibF2CConfig.cmake"
@ONLY
)
......@@ -118,8 +111,15 @@ endif ()
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/NetlibF2CConfigVersion.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/NetlibF2CConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/NetlibF2C_Targets-library.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/NetlibF2CConfig.cmake"
DESTINATION "${NetlibF2C_INSTALL_CMAKEDIR}"
COMPONENT executable
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/NetlibF2CConfigVersion.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/NetlibF2CConfig.cmake"
DESTINATION "${NetlibF2C_INSTALL_CMAKEDIR}"
COMPONENT library
)
#[[
CMake build script for netlib f2c
Copyright (C) 2024 Tim Kaune
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see
<https://www.gnu.org/licenses/>.
]]
cmake_minimum_required(VERSION 3.25)
# If CMake >=3.24 is used, set policies up to v3.24 to NEW
# if (NOT ${CMAKE_VERSION} VERSION_LESS 3.24)
# cmake_policy(VERSION 3.24)
# endif()
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/NetlibF2C_Targets-executable.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/NetlibF2C_Targets-executable.cmake")
endif ()
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/NetlibF2C_Targets-library.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/NetlibF2C_Targets-library.cmake")
endif ()
......@@ -17,6 +17,13 @@ License along with this program. If not, see
<https://www.gnu.org/licenses/>.
]]
cmake_minimum_required(VERSION 3.25)
# If CMake >=3.24 is used, set policies up to v3.24 to NEW
# if (NOT ${CMAKE_VERSION} VERSION_LESS 3.24)
# cmake_policy(VERSION 3.24)
# endif()
set(
LoadStaticSharedTargets_DIR
"@LoadStaticSharedTargets_DIR@"
......@@ -30,7 +37,9 @@ include(LoadStaticSharedTargets)
load_static_shared_targets(
STATIC_TARGETS
"${CMAKE_CURRENT_LIST_DIR}/NetlibF2C_Targets-executable-static.cmake"
"${CMAKE_CURRENT_LIST_DIR}/NetlibF2C_Targets-library-static.cmake"
SHARED_TARGETS
"${CMAKE_CURRENT_LIST_DIR}/NetlibF2C_Targets-executable-shared.cmake"
"${CMAKE_CURRENT_LIST_DIR}/NetlibF2C_Targets-library-shared.cmake"
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment