mirror of
https://github.com/albertodemichelis/squirrel.git
synced 2026-01-12 06:28:43 +01:00
Merge pull request #144 from DerDakon/cmake-vars
properly check CMake variables for being set
This commit is contained in:
@ -8,7 +8,9 @@ option(DISABLE_STATIC "Avoid building/installing static libraries.")
|
||||
option(LONG_OUTPUT_NAMES "Use longer names for binaries and libraries: squirrel3 (not sq).")
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}" CACHE PATH "")
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif ()
|
||||
|
||||
project(squirrel C CXX)
|
||||
|
||||
@ -43,12 +45,12 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_definitions(-D_SQ64)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||
if(NOT DEFINED INSTALL_BIN_DIR)
|
||||
if(NOT SQ_DISABLE_INSTALLER)
|
||||
if(NOT INSTALL_BIN_DIR)
|
||||
set(INSTALL_BIN_DIR bin)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED INSTALL_LIB_DIR)
|
||||
if(NOT INSTALL_LIB_DIR)
|
||||
set(INSTALL_LIB_DIR lib)
|
||||
endif()
|
||||
endif()
|
||||
@ -57,11 +59,11 @@ add_subdirectory(squirrel)
|
||||
add_subdirectory(sqstdlib)
|
||||
add_subdirectory(sq)
|
||||
|
||||
if(NOT WIN32 AND NOT DEFINED DISABLE_DYNAMIC)
|
||||
if(NOT WIN32 AND NOT DISABLE_DYNAMIC)
|
||||
set_target_properties(squirrel sqstdlib PROPERTIES SOVERSION 0 VERSION 0.0.0)
|
||||
endif()
|
||||
|
||||
if(DEFINED INSTALL_INC_DIR)
|
||||
if(INSTALL_INC_DIR)
|
||||
set(SQ_PUB_HEADERS include/sqconfig.h
|
||||
include/sqstdaux.h
|
||||
include/sqstdblob.h
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||
if(NOT DISABLE_DYNAMIC)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set_source_files_properties(sq.c PROPERTIES COMPILE_FLAGS -std=c99)
|
||||
endif()
|
||||
add_executable(sq sq.c)
|
||||
set_target_properties(sq PROPERTIES LINKER_LANGUAGE C)
|
||||
target_link_libraries(sq squirrel sqstdlib)
|
||||
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||
if(NOT SQ_DISABLE_INSTALLER)
|
||||
install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED DISABLE_STATIC)
|
||||
if(NOT DISABLE_STATIC)
|
||||
add_executable(sq_static sq.c)
|
||||
set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C)
|
||||
target_link_libraries(sq_static squirrel_static sqstdlib_static)
|
||||
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||
if(NOT SQ_DISABLE_INSTALLER)
|
||||
install(TARGETS sq_static RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED LONG_OUTPUT_NAMES)
|
||||
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||
if(LONG_OUTPUT_NAMES)
|
||||
if(NOT DISABLE_DYNAMIC)
|
||||
set_target_properties(sq PROPERTIES OUTPUT_NAME squirrel3)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED DISABLE_STATIC)
|
||||
if(NOT DISABLE_STATIC)
|
||||
set_target_properties(sq_static PROPERTIES OUTPUT_NAME squirrel3_static)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND (NOT DEFINED DISABLE_STATIC))
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT DISABLE_STATIC)
|
||||
set_target_properties(sq_static PROPERTIES COMPILE_FLAGS "-static -Wl,-static")
|
||||
endif()
|
||||
|
||||
@ -7,29 +7,29 @@ set(SQSTDLIB_SRC sqstdaux.cpp
|
||||
sqstdstring.cpp
|
||||
sqstdsystem.cpp)
|
||||
|
||||
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||
if(NOT DISABLE_DYNAMIC)
|
||||
add_library(sqstdlib SHARED ${SQSTDLIB_SRC})
|
||||
target_link_libraries(sqstdlib squirrel)
|
||||
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||
if(NOT SQ_DISABLE_INSTALLER)
|
||||
install(TARGETS sqstdlib RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
||||
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED DISABLE_STATIC)
|
||||
if(NOT DISABLE_STATIC)
|
||||
add_library(sqstdlib_static STATIC ${SQSTDLIB_SRC})
|
||||
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||
if(NOT SQ_DISABLE_INSTALLER)
|
||||
install(TARGETS sqstdlib_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED LONG_OUTPUT_NAMES)
|
||||
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||
if(LONG_OUTPUT_NAMES)
|
||||
if(NOT DISABLE_DYNAMIC)
|
||||
set_target_properties(sqstdlib PROPERTIES OUTPUT_NAME sqstdlib3)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED DISABLE_STATIC)
|
||||
if(NOT DISABLE_STATIC)
|
||||
set_target_properties(sqstdlib_static PROPERTIES OUTPUT_NAME sqstdlib3_static)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -11,28 +11,28 @@ set(SQUIRREL_SRC sqapi.cpp
|
||||
sqtable.cpp
|
||||
sqvm.cpp)
|
||||
|
||||
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||
if(NOT DISABLE_DYNAMIC)
|
||||
add_library(squirrel SHARED ${SQUIRREL_SRC})
|
||||
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||
if(NOT SQ_DISABLE_INSTALLER)
|
||||
install(TARGETS squirrel RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
||||
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED DISABLE_STATIC)
|
||||
if(NOT DISABLE_STATIC)
|
||||
add_library(squirrel_static STATIC ${SQUIRREL_SRC})
|
||||
if(NOT DEFINED SQ_DISABLE_INSTALLER)
|
||||
if(NOT SQ_DISABLE_INSTALLER)
|
||||
install(TARGETS squirrel_static ARCHIVE DESTINATION ${INSTALL_LIB_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED LONG_OUTPUT_NAMES)
|
||||
if(NOT DEFINED DISABLE_DYNAMIC)
|
||||
if(LONG_OUTPUT_NAMES)
|
||||
if(NOT DISABLE_DYNAMIC)
|
||||
set_target_properties(squirrel PROPERTIES OUTPUT_NAME squirrel3)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED DISABLE_STATIC)
|
||||
if(NOT DISABLE_STATIC)
|
||||
set_target_properties(squirrel_static PROPERTIES OUTPUT_NAME squirrel3_static)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user