Add DISABLE_DYNAMIC to disable building shared libs for the case where you only want static libs.

This commit is contained in:
Paul 2017-02-25 14:40:47 +00:00
parent 05dbbc1820
commit d130dc5471
3 changed files with 24 additions and 12 deletions

View File

@ -1,7 +1,9 @@
add_executable(sq sq.c)
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
target_link_libraries(sq squirrel sqstdlib)
install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR})
if(NOT DEFINED DISABLE_DYNAMIC)
add_executable(sq sq.c)
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
target_link_libraries(sq squirrel sqstdlib)
install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR})
endif()
if(NOT DEFINED DISABLE_STATIC)
add_executable(sq_static sq.c)
@ -11,7 +13,9 @@ if(NOT DEFINED DISABLE_STATIC)
endif()
if(DEFINED LONG_OUTPUT_NAMES)
set_target_properties(sq PROPERTIES OUTPUT_NAME squirrel3)
if(NOT DEFINED DISABLE_DYNAMIC)
set_target_properties(sq PROPERTIES OUTPUT_NAME squirrel3)
endif()
if(NOT DEFINED DISABLE_STATIC)
set_target_properties(sq_static PROPERTIES OUTPUT_NAME squirrel3_static)

View File

@ -7,11 +7,13 @@ set(SQSTDLIB_SRC sqstdaux.cpp
sqstdstring.cpp
sqstdsystem.cpp)
add_library(sqstdlib SHARED ${SQSTDLIB_SRC})
target_link_libraries(sqstdlib squirrel)
install(TARGETS sqstdlib RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
if(NOT DEFINED DISABLE_DYNAMIC)
add_library(sqstdlib SHARED ${SQSTDLIB_SRC})
target_link_libraries(sqstdlib squirrel)
install(TARGETS sqstdlib RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
endif()
if(NOT DEFINED DISABLE_STATIC)
add_library(sqstdlib_static STATIC ${SQSTDLIB_SRC})
@ -19,7 +21,9 @@ if(NOT DEFINED DISABLE_STATIC)
endif()
if(DEFINED LONG_OUTPUT_NAMES)
set_target_properties(sqstdlib PROPERTIES OUTPUT_NAME sqstdlib3)
if(NOT DEFINED DISABLE_DYNAMIC)
set_target_properties(sqstdlib PROPERTIES OUTPUT_NAME sqstdlib3)
endif()
if(NOT DEFINED DISABLE_STATIC)
set_target_properties(sqstdlib_static PROPERTIES OUTPUT_NAME sqstdlib3_static)

View File

@ -11,10 +11,12 @@ set(SQUIRREL_SRC sqapi.cpp
sqtable.cpp
sqvm.cpp)
if(NOT DEFINED DISABLE_DYNAMIC)
add_library(squirrel SHARED ${SQUIRREL_SRC})
install(TARGETS squirrel RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
endif()
if(NOT DEFINED DISABLE_STATIC)
add_library(squirrel_static STATIC ${SQUIRREL_SRC})
@ -22,7 +24,9 @@ if(NOT DEFINED DISABLE_STATIC)
endif()
if(DEFINED LONG_OUTPUT_NAMES)
set_target_properties(squirrel PROPERTIES OUTPUT_NAME squirrel3)
if(NOT DEFINED DISABLE_DYNAMIC)
set_target_properties(squirrel PROPERTIES OUTPUT_NAME squirrel3)
endif()
if(NOT DEFINED DISABLE_STATIC)
set_target_properties(squirrel_static PROPERTIES OUTPUT_NAME squirrel3_static)