Skip to content

Commit

Permalink
Build as shared library or static library
Browse files Browse the repository at this point in the history
  • Loading branch information
topazus committed Jan 27, 2024
1 parent 8786740 commit b86055f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1029,15 +1029,6 @@ else()
add_library(draco::draco ALIAS draco)

else()
draco_add_library(
NAME draco_static
OUTPUT_NAME draco
TYPE STATIC
DEFINES ${draco_defines}
INCLUDES ${draco_include_paths}
OBJLIB_DEPS ${draco_object_library_deps}
LIB_DEPS ${draco_lib_deps})

if(BUILD_SHARED_LIBS)
draco_add_library(
NAME draco_shared
Expand All @@ -1046,10 +1037,19 @@ else()
TYPE SHARED
DEFINES ${draco_defines}
INCLUDES ${draco_include_paths}
LIB_DEPS draco_static)
OBJLIB_DEPS ${draco_object_library_deps}
LIB_DEPS ${draco_lib_deps})
add_library(draco::draco ALIAS draco_shared)
set_target_properties(draco_shared PROPERTIES EXPORT_NAME draco)
else()
draco_add_library(
NAME draco_static
OUTPUT_NAME draco
TYPE STATIC
DEFINES ${draco_defines}
INCLUDES ${draco_include_paths}
OBJLIB_DEPS ${draco_object_library_deps}
LIB_DEPS ${draco_lib_deps})
add_library(draco::draco ALIAS draco_static)
set_target_properties(draco_static PROPERTIES EXPORT_NAME draco)
endif()
Expand Down
9 changes: 5 additions & 4 deletions cmake/draco_install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ macro(draco_setup_install_target)
ARCHIVE DESTINATION "${libs_path}"
LIBRARY DESTINATION "${libs_path}")
else()
install(
TARGETS draco_static
EXPORT dracoExport
DESTINATION "${libs_path}")

if(BUILD_SHARED_LIBS)
install(
Expand All @@ -78,6 +74,11 @@ macro(draco_setup_install_target)
RUNTIME DESTINATION "${bin_path}"
ARCHIVE DESTINATION "${libs_path}"
LIBRARY DESTINATION "${libs_path}")
else()
install(
TARGETS draco_static
EXPORT dracoExport
DESTINATION "${libs_path}")
endif()
endif()

Expand Down

0 comments on commit b86055f

Please sign in to comment.