|
| 1 | +# Copyright (C) 2025 Andrew D Smith |
| 2 | +# |
| 3 | +# This program is free software: you can redistribute it and/or modify it |
| 4 | +# under the terms of the GNU General Public License as published by the Free |
| 5 | +# Software Foundation, either version 3 of the License, or (at your option) |
| 6 | +# any later version. |
| 7 | +# |
| 8 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
| 9 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | +# more details. |
| 12 | +# |
| 13 | +# You should have received a copy of the GNU General Public License along with |
| 14 | +# this program. If not, see <https://www.gnu.org/licenses/>. |
| 15 | + |
| 16 | +# to find the version of cmake do |
| 17 | +# $ cmake --version |
| 18 | +cmake_minimum_required(VERSION 3.30) |
| 19 | +project( |
| 20 | + smithlab_cpp |
| 21 | + VERSION 1.2.0 |
| 22 | + DESCRIPTION |
| 23 | + "smithlab_cpp" |
| 24 | + HOMEPAGE_URL https://github.com/smithlabcode/smithlab_cpp |
| 25 | + LANGUAGES CXX) |
| 26 | + |
| 27 | +# Set language version used |
| 28 | +set(CMAKE_CXX_STANDARD 17) |
| 29 | +set(CMAKE_CXX_STANDARD_REQUIRED off) |
| 30 | +set(CMAKE_CXX_EXTENSIONS off) # prevents std=gnu++17 |
| 31 | +set(CMAKE_EXPORT_COMPILE_COMMANDS on) |
| 32 | + |
| 33 | +include(GNUInstallDirs) |
| 34 | + |
| 35 | +file(GLOB cpp_files "*.cpp") |
| 36 | + |
| 37 | +set(LIBRARY_OBJECTS "") |
| 38 | +foreach(cpp_file ${cpp_files}) |
| 39 | + get_filename_component(BASE_NAME ${cpp_file} NAME_WE) |
| 40 | + add_library(${BASE_NAME} OBJECT ${cpp_file}) |
| 41 | + list(APPEND LIBRARY_OBJECTS ${BASE_NAME}) |
| 42 | +endforeach() |
| 43 | + |
| 44 | +add_library(smithlab_cpp) |
| 45 | +target_include_directories(smithlab_cpp PUBLIC) |
| 46 | +target_link_libraries(smithlab_cpp PUBLIC ${LIBRARY_OBJECTS}) |
0 commit comments