build: check if building .h only lib (interface) or static lib
This commit is contained in:
+25
-3
@@ -43,10 +43,32 @@ if (SEALLIB_VFS)
|
|||||||
list(APPEND SEALLIB_SOURCES "src/lib/seallib/vfs.cpp" "src/lib/seallib/vfs.h")
|
list(APPEND SEALLIB_SOURCES "src/lib/seallib/vfs.cpp" "src/lib/seallib/vfs.h")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(seallib STATIC ${SEALLIB_SOURCES})
|
set(SEALLIB_HAS_SOURCES FALSE)
|
||||||
|
foreach(src ${SEALLIB_SOURCES})
|
||||||
|
if(src MATCHES "\\.cpp$")
|
||||||
|
set(SEALLIB_HAS_SOURCES TRUE)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if (SEALLIB_HAS_SOURCES)
|
||||||
|
SEALLIB_HAS_SOURCES(seallib STATIC ${SEALLIB_SOURCES})
|
||||||
|
else()
|
||||||
|
add_library(seallib INTERFACE)
|
||||||
|
target_sources(seallib INTERFACE ${SEALLIB_SOURCES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SEALLIB_HAS_SOURCES)
|
||||||
|
set(SEALLIB_SCOPE PUBLIC)
|
||||||
|
else()
|
||||||
|
set(SEALLIB_SCOPE INTERFACE)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(seallib PROPERTIES LINKER_LANGUAGE CXX)
|
set_target_properties(seallib PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
target_include_directories(seallib PUBLIC src/lib)
|
|
||||||
target_compile_features(seallib PUBLIC cxx_std_20)
|
target_include_directories(seallib ${SEALLIB_SCOPE} src/lib)
|
||||||
|
target_compile_features(seallib ${SEALLIB_SCOPE} cxx_std_20)
|
||||||
|
|
||||||
set_target_properties(seallib PROPERTIES CXX_EXTENSIONS OFF)
|
set_target_properties(seallib PROPERTIES CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user