nix-gcc-multi-issue/CMakeLists.txt

83 lines
2.1 KiB
CMake
Raw Normal View History

2024-05-14 14:46:35 +00:00
cmake_minimum_required(VERSION 3.14)
include(cmake/prelude.cmake)
project(
nix-gcc-multi-issue
VERSION 0.1.0
DESCRIPTION "Short description"
HOMEPAGE_URL "https://example.com/"
LANGUAGES CXX
)
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)
# ---- Declare library ----
# build as 32-bit library
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(
nix-gcc-multi-issue_nix-gcc-multi-issue
SHARED
source/nix-gcc-multi-issue.cpp
)
add_library(nix-gcc-multi-issue::nix-gcc-multi-issue ALIAS nix-gcc-multi-issue_nix-gcc-multi-issue)
include(GenerateExportHeader)
generate_export_header(
nix-gcc-multi-issue_nix-gcc-multi-issue
BASE_NAME nix-gcc-multi-issue
EXPORT_FILE_NAME export/nix-gcc-multi-issue/nix-gcc-multi-issue_export.hpp
CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251
)
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(nix-gcc-multi-issue_nix-gcc-multi-issue PUBLIC NIX_GCC_MULTI_ISSUE_STATIC_DEFINE)
endif()
set_target_properties(
nix-gcc-multi-issue_nix-gcc-multi-issue PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}"
EXPORT_NAME nix-gcc-multi-issue
OUTPUT_NAME nix-gcc-multi-issue
)
target_include_directories(
nix-gcc-multi-issue_nix-gcc-multi-issue ${warning_guard}
PUBLIC
"\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
)
target_include_directories(
nix-gcc-multi-issue_nix-gcc-multi-issue SYSTEM
PUBLIC
"\$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/export>"
)
target_compile_features(nix-gcc-multi-issue_nix-gcc-multi-issue PUBLIC cxx_std_17)
# ---- Install rules ----
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install-rules.cmake)
endif()
# ---- Developer mode ----
if(NOT nix-gcc-multi-issue_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(
AUTHOR_WARNING
"Developer mode is intended for developers of nix-gcc-multi-issue"
)
endif()
include(cmake/dev-mode.cmake)