mirror of
https://github.com/cimgui/cimgui.git
synced 2025-08-13 05:08:31 +01:00
cmake: add an option to build as a static library
Useful when including cimgui as a subproject in another CMake project.
This commit is contained in:
@@ -16,9 +16,15 @@ else(WIN32)
|
|||||||
add_definitions("-DIMGUI_IMPL_API=extern \"C\" ")
|
add_definitions("-DIMGUI_IMPL_API=extern \"C\" ")
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
set(IMGUI_STATIC "no" CACHE STRING "Build as a static library")
|
||||||
|
|
||||||
#add library and link
|
#add library and link
|
||||||
add_library(cimgui SHARED ${IMGUI_SOURCES})
|
if (IMGUI_STATIC)
|
||||||
|
add_library(cimgui STATIC ${IMGUI_SOURCES})
|
||||||
|
else (IMGUI_STATIC)
|
||||||
|
add_library(cimgui SHARED ${IMGUI_SOURCES})
|
||||||
|
endif (IMGUI_STATIC)
|
||||||
|
|
||||||
target_link_libraries(cimgui ${IMGUI_LIBRARIES})
|
target_link_libraries(cimgui ${IMGUI_LIBRARIES})
|
||||||
set_target_properties(cimgui PROPERTIES PREFIX "")
|
set_target_properties(cimgui PROPERTIES PREFIX "")
|
||||||
|
|
||||||
@@ -26,5 +32,5 @@ set_target_properties(cimgui PROPERTIES PREFIX "")
|
|||||||
install(TARGETS cimgui
|
install(TARGETS cimgui
|
||||||
RUNTIME DESTINATION .
|
RUNTIME DESTINATION .
|
||||||
LIBRARY DESTINATION .
|
LIBRARY DESTINATION .
|
||||||
#ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION .
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user