if(NOT DEFINED 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)
    install(TARGETS sq RUNTIME DESTINATION ${INSTALL_BIN_DIR})
  endif()
endif()

if(NOT DEFINED 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)
    install(TARGETS sq_static RUNTIME DESTINATION ${INSTALL_BIN_DIR})
  endif()
endif()

if(DEFINED LONG_OUTPUT_NAMES)
  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)
  endif()
endif()

if(CMAKE_COMPILER_IS_GNUCXX AND (NOT DEFINED DISABLE_STATIC))
  set_target_properties(sq_static PROPERTIES COMPILE_FLAGS "-static -Wl,-static")
endif()
