@@ -111,19 +111,9 @@ endif()
111
111
112
112
# Configuration
113
113
include (GNUInstallDirs)
114
- set (STRINGZILLA_TARGET_NAME ${PROJECT_NAME} )
115
114
set (STRINGZILLA_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR} /include/" )
116
115
set (STRINGZILLA_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR} " )
117
116
118
- # Define our library
119
- add_library (${STRINGZILLA_TARGET_NAME} INTERFACE )
120
- add_library (${PROJECT_NAME} ::${STRINGZILLA_TARGET_NAME} ALIAS ${STRINGZILLA_TARGET_NAME} )
121
-
122
- target_include_directories (
123
- ${STRINGZILLA_TARGET_NAME}
124
- INTERFACE $<BUILD_INTERFACE:${STRINGZILLA_INCLUDE_BUILD_DIR} >
125
- $<INSTALL_INTERFACE:include >)
126
-
127
117
128
118
if (${CMAKE_VERSION} VERSION_EQUAL 3.13 OR ${CMAKE_VERSION} VERSION_GREATER 3.13)
129
119
include (CTest)
@@ -142,7 +132,6 @@ function(set_compiler_flags target cpp_standard target_arch)
142
132
get_target_property (target_type ${target} TYPE )
143
133
144
134
target_include_directories (${target} PRIVATE scripts)
145
- target_link_libraries (${target} PRIVATE ${STRINGZILLA_TARGET_NAME} )
146
135
147
136
# Set output directory for single-configuration generators (like Make)
148
137
set_target_properties (${target} PROPERTIES
@@ -278,6 +267,7 @@ endfunction()
278
267
function (define_launcher exec_name source cpp_standard target_arch)
279
268
add_executable (${exec_name} ${source} )
280
269
set_compiler_flags(${exec_name} ${cpp_standard} "${target_arch} " )
270
+ target_link_libraries (${exec_name} PRIVATE stringzilla_header)
281
271
add_test (NAME ${exec_name} COMMAND ${exec_name} )
282
272
endfunction ()
283
273
@@ -319,10 +309,20 @@ if(${STRINGZILLA_BUILD_TEST})
319
309
endif ()
320
310
endif ()
321
311
312
+ # Define our libraries, first the header-only version
313
+ add_library (stringzilla_header INTERFACE )
314
+ add_library (${PROJECT_NAME} ::stringzilla_header ALIAS stringzilla_header)
315
+ target_include_directories (
316
+ stringzilla_header
317
+ INTERFACE $<BUILD_INTERFACE:${STRINGZILLA_INCLUDE_BUILD_DIR} >
318
+ $<INSTALL_INTERFACE:include >)
319
+
320
+
322
321
if (${STRINGZILLA_BUILD_SHARED} )
323
322
324
323
function (define_shared target )
325
324
add_library (${target} SHARED c/lib.c)
325
+ add_library (${PROJECT_NAME} ::${target} ALIAS ${target} )
326
326
327
327
set_target_properties (${target} PROPERTIES
328
328
VERSION ${PROJECT_VERSION}
0 commit comments