Skip to content

Commit 92ed325

Browse files
authored
Merge pull request #6 from saxbophone/josh/header-only
Switched project to strictly header-only:
2 parents 67310f1 + 136ce60 commit 92ed325

File tree

4 files changed

+5
-46
lines changed

4 files changed

+5
-46
lines changed

tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ unset(flag_supported CACHE)
3737
target_link_libraries(
3838
tests
3939
PRIVATE
40-
unmoving-compiler-options # tests use same compiler options as main project
40+
unmoving-compiler-options # use custom compiler options
4141
unmoving
4242
Catch2::Catch2 # unit testing framework
4343
)

unmoving/CMakeLists.txt

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,19 @@
11
include(GNUInstallDirs)
22

3-
add_library(unmoving STATIC)
3+
add_library(unmoving INTERFACE) # use INTERFACE for a header-only library
44
# ALIAS target to export a namespaced target even when building in-tree
55
add_library(Unmoving::unmoving ALIAS unmoving)
6-
# add source files
7-
add_subdirectory(src)
86
# library public header files location
97
target_include_directories(
10-
unmoving PUBLIC
8+
unmoving INTERFACE
119
# different include directory path depending on if using the local or installed version of library
1210
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
1311
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
1412
)
15-
# pass in version of project as preprocessor definitions
16-
target_compile_definitions(
17-
unmoving PRIVATE
18-
-DUNMOVING_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
19-
-DUNMOVING_VERSION_MINOR=${PROJECT_VERSION_MINOR}
20-
-DUNMOVING_VERSION_PATCH=${PROJECT_VERSION_PATCH}
21-
-DUNMOVING_VERSION_STRING=${UNMOVING_ESCAPED_VERSION_STRING}
22-
)
23-
# set up version and soversion for the main library object
24-
set_target_properties(
25-
unmoving PROPERTIES
26-
VERSION ${UNMOVING_VERSION_STRING}
27-
SOVERSION ${PROJECT_VERSION_MAJOR}
28-
INTERFACE_unmoving_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}
29-
INTERFACE_unmoving_MINOR_VERSION ${PROJECT_VERSION_MINOR}
30-
)
13+
# not 100% sure if this is still needed, but it appears in the package-config output so best to keep
3114
set_property(
3215
TARGET unmoving
33-
APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "${Unmoving_MAJOR_VERSION}.${Unmoving_MINOR_VERSION}"
34-
)
35-
# inherit common project compiler options
36-
target_link_libraries(
37-
unmoving
38-
PRIVATE
39-
$<BUILD_INTERFACE:unmoving-compiler-options>
16+
APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
4017
)
4118

4219
# install if we're not being built as a sub-project

unmoving/src/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

unmoving/src/Fixed.cpp

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)