Change BUILD_{STATIC,SHARED}_LIBRARIES to ENABLE_

This commit is contained in:
Matt Williams
2012-07-15 20:22:46 +01:00
parent 6fd7079e7c
commit 00e2f37f31
3 changed files with 22 additions and 22 deletions

View File

@ -4,30 +4,30 @@ PROJECT(PolyVox)
#By default only build static libraries on Windows but both on Linux
#If we ever require CMake 2.8 then use http://www.kitware.com/blog/home/post/82
option(BUILD_STATIC_LIBRARIES "Build static libraries" ON)
option(ENABLE_STATIC_LIBRARIES "Build static libraries" ON)
if(WIN32)
option(BUILD_DYNAMIC_LIBRARIES "Build dynamic libraries" OFF)
option(ENABLE_DYNAMIC_LIBRARIES "Build dynamic libraries" OFF)
else()
option(BUILD_DYNAMIC_LIBRARIES "Build dynamic libraries" ON)
option(ENABLE_DYNAMIC_LIBRARIES "Build dynamic libraries" ON)
endif()
if(WIN32)
#If both are enabled then diable the dyanamic build
if(BUILD_STATIC_LIBRARIES AND BUILD_DYNAMIC_LIBRARIES)
if(ENABLE_STATIC_LIBRARIES AND ENABLE_DYNAMIC_LIBRARIES)
message(STATUS "Building both static and dynamic libraries is not supported on Windows. Disabling dynamic libraries.")
set(BUILD_DYNAMIC_LIBRARIES OFF CACHE BOOL "Build dynamic libraries" FORCE)
set(ENABLE_DYNAMIC_LIBRARIES OFF CACHE BOOL "Build dynamic libraries" FORCE)
endif()
#If both are diabled then re-enable the static build
if(NOT BUILD_STATIC_LIBRARIES AND NOT BUILD_DYNAMIC_LIBRARIES)
if(NOT ENABLE_STATIC_LIBRARIES AND NOT ENABLE_DYNAMIC_LIBRARIES)
message(STATUS "Both dynamic and static libraries were disabled - re-enabling static build.")
set(BUILD_STATIC_LIBRARIES ON CACHE BOOL "Build static libraries" FORCE)
set(ENABLE_STATIC_LIBRARIES ON CACHE BOOL "Build static libraries" FORCE)
endif()
else()
#It's nonsense to disble both so on Linux, re-enable both.
if(NOT BUILD_STATIC_LIBRARIES AND NOT BUILD_DYNAMIC_LIBRARIES)
if(NOT ENABLE_STATIC_LIBRARIES AND NOT ENABLE_DYNAMIC_LIBRARIES)
message(STATUS "Both dynamic and static libraries were disabled - re-enabling both.")
set(BUILD_STATIC_LIBRARIES ON CACHE BOOL "Build static libraries" FORCE)
set(BUILD_DYNAMIC_LIBRARIES ON CACHE BOOL "Build dynamic libraries" FORCE)
set(ENABLE_STATIC_LIBRARIES ON CACHE BOOL "Build static libraries" FORCE)
set(ENABLE_DYNAMIC_LIBRARIES ON CACHE BOOL "Build dynamic libraries" FORCE)
endif()
endif()