[build] Fix cmake shared library build

BUILD_SHARED_LIBS is a cmake built-in and must be this name.

Also check for BUILD_SHARED_LIBS with WITH_SIMULATION_MODULES.
This commit is contained in:
Peter Johnson
2020-10-23 00:12:40 -07:00
parent 0927c73b13
commit 5d085b78bd

View File

@@ -41,8 +41,8 @@ IF("${isSystemDir}" STREQUAL "-1")
ENDIF("${isSystemDir}" STREQUAL "-1")
# Options for building certain parts of the repo. Everything is built by default.
option(BUILD_SHARED_LIBS "Build with shared libs (needed for JNI)" ON)
option(WITH_JAVA "Include java and JNI in the build" ON)
option(WITH_SHARED_LIBS "Build with shared libs (needed for JNI)" ON)
option(WITH_CSCORE "Build cscore (needs OpenCV)" ON)
option(WITH_WPILIB "Build hal, wpilibc/j, wpimath, and myRobot (needs OpenCV)" ON)
option(WITH_TESTS "Build unit tests (requires internet connection)" ON)
@@ -73,14 +73,22 @@ if (MSVC)
set(WITH_FLAT_INSTALL ON)
endif()
if (WITH_JAVA AND NOT WITH_SHARED_LIBS)
if (WITH_JAVA AND NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "
FATAL: Cannot build static libs with Java enabled.
Static libs requires both WITH_SHARED_LIBS=OFF and
Static libs requires both BUILD_SHARED_LIBS=OFF and
WITH_JAVA=OFF
")
endif()
if (WITH_SIMULATION_MODULES AND NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "
FATAL: Cannot build static libs with simulation modules enabled.
Static libs requires both BUILD_SHARED_LIBS=OFF and
WITH_SIMULATION_MODULES=OFF
")
endif()
if (NOT WITH_JAVA OR NOT WITH_CSCORE)
if(NOT "${OPENCV_JAVA_INSTALL_DIR}" STREQUAL "")
message(WARNING "