Allow disable of CMake install() sections

This commit is contained in:
Paul 2017-03-27 21:08:56 +01:00
parent 5b3bfb21fb
commit aa4afc5b14
4 changed files with 27 additions and 13 deletions

View File

@ -39,19 +39,21 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-D_SQ64) add_definitions(-D_SQ64)
endif() endif()
if(NOT DEFINED INSTALL_BIN_DIR) if(NOT DEFINED SQ_DISABLE_INSTALLER)
set(INSTALL_BIN_DIR bin) if(NOT DEFINED INSTALL_BIN_DIR)
endif() set(INSTALL_BIN_DIR bin)
endif()
if(NOT DEFINED INSTALL_LIB_DIR) if(NOT DEFINED INSTALL_LIB_DIR)
set(INSTALL_LIB_DIR lib) set(INSTALL_LIB_DIR lib)
endif()
endif() endif()
add_subdirectory(squirrel) add_subdirectory(squirrel)
add_subdirectory(sqstdlib) add_subdirectory(sqstdlib)
add_subdirectory(sq) add_subdirectory(sq)
if(NOT WIN32) if(NOT WIN32 AND NOT DEFINED DISABLE_DYNAMIC)
set_target_properties(squirrel sqstdlib PROPERTIES SOVERSION 0 VERSION 0.0.0) set_target_properties(squirrel sqstdlib PROPERTIES SOVERSION 0 VERSION 0.0.0)
endif() endif()

View File

@ -2,14 +2,18 @@ if(NOT DEFINED DISABLE_DYNAMIC)
add_executable(sq sq.c) add_executable(sq sq.c)
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C) set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
target_link_libraries(sq squirrel sqstdlib) target_link_libraries(sq squirrel sqstdlib)
install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR}) if(NOT DEFINED SQ_DISABLE_INSTALLER)
install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR})
endif()
endif() endif()
if(NOT DEFINED DISABLE_STATIC) if(NOT DEFINED DISABLE_STATIC)
add_executable(sq_static sq.c) add_executable(sq_static sq.c)
set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C) set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C)
target_link_libraries(sq_static squirrel_static sqstdlib_static) target_link_libraries(sq_static squirrel_static sqstdlib_static)
install(TARGETS sq_static RUNTIME DESTINATION ${INSTALL_BIN_DIR}) if(NOT DEFINED SQ_DISABLE_INSTALLER)
install(TARGETS sq_static RUNTIME DESTINATION ${INSTALL_BIN_DIR})
endif()
endif() endif()
if(DEFINED LONG_OUTPUT_NAMES) if(DEFINED LONG_OUTPUT_NAMES)

View File

@ -10,14 +10,18 @@ set(SQSTDLIB_SRC sqstdaux.cpp
if(NOT DEFINED DISABLE_DYNAMIC) if(NOT DEFINED DISABLE_DYNAMIC)
add_library(sqstdlib SHARED ${SQSTDLIB_SRC}) add_library(sqstdlib SHARED ${SQSTDLIB_SRC})
target_link_libraries(sqstdlib squirrel) target_link_libraries(sqstdlib squirrel)
install(TARGETS sqstdlib RUNTIME DESTINATION ${INSTALL_BIN_DIR} if(NOT DEFINED SQ_DISABLE_INSTALLER)
install(TARGETS sqstdlib RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR} LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR}) ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
endif()
endif() endif()
if(NOT DEFINED DISABLE_STATIC) if(NOT DEFINED DISABLE_STATIC)
add_library(sqstdlib_static STATIC ${SQSTDLIB_SRC}) add_library(sqstdlib_static STATIC ${SQSTDLIB_SRC})
install(TARGETS sqstdlib_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR}) if(NOT DEFINED SQ_DISABLE_INSTALLER)
install(TARGETS sqstdlib_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
endif()
endif() endif()
if(DEFINED LONG_OUTPUT_NAMES) if(DEFINED LONG_OUTPUT_NAMES)

View File

@ -12,15 +12,19 @@ set(SQUIRREL_SRC sqapi.cpp
sqvm.cpp) sqvm.cpp)
if(NOT DEFINED DISABLE_DYNAMIC) if(NOT DEFINED DISABLE_DYNAMIC)
add_library(squirrel SHARED ${SQUIRREL_SRC}) add_library(squirrel SHARED ${SQUIRREL_SRC})
install(TARGETS squirrel RUNTIME DESTINATION ${INSTALL_BIN_DIR} if(NOT DEFINED SQ_DISABLE_INSTALLER)
install(TARGETS squirrel RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR} LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR}) ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
endif()
endif() endif()
if(NOT DEFINED DISABLE_STATIC) if(NOT DEFINED DISABLE_STATIC)
add_library(squirrel_static STATIC ${SQUIRREL_SRC}) add_library(squirrel_static STATIC ${SQUIRREL_SRC})
install(TARGETS squirrel_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR}) if(NOT DEFINED SQ_DISABLE_INSTALLER)
install(TARGETS squirrel_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
endif()
endif() endif()
if(DEFINED LONG_OUTPUT_NAMES) if(DEFINED LONG_OUTPUT_NAMES)