Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro 1.0.0
authorLocutusOfBorg
Mon, 12 Sep 2022 12:51:41 -0400
branch1.0.0
changeset 15862 c96220666d93
parent 15861 9d4ba1912e71
child 15863 d04f4a0af0fe
Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
cmake_modules/CheckHaskellPackageExists.cmake
gameServer/CMakeLists.txt
--- a/cmake_modules/CheckHaskellPackageExists.cmake	Mon Sep 12 12:50:37 2022 -0400
+++ b/cmake_modules/CheckHaskellPackageExists.cmake	Mon Sep 12 12:51:41 2022 -0400
@@ -11,7 +11,7 @@
 # See the License for more information.
 #=============================================================================
 
-macro(CHECK_HASKELL_PACKAGE_EXISTS PACKAGE MODULE FUNCTION PARAMCOUNT)
+macro(CHECK_HASKELL_PACKAGE_EXISTS PACKAGE MODULE FUNCTION PARAMCOUNT REQUIRED)
 # NOTE: MODULE, FUNCTION and PARAMCOUNT are curretly ignored.
 # TODO: Either implement these or drop?
 
@@ -41,7 +41,11 @@
         "Determining if the Haskell package ${PACKAGE} "
         "exists failed with the following output:\n"
         "${BUILD_ERROR}\n\n")
-      message(FATAL_ERROR "Haskell package '${PACKAGE}' required")
+      if("${REQUIRED}" STREQUAL "REQUIRED")
+        message(FATAL_ERROR "Haskell package '${PACKAGE}' required")
+      else()
+        message(STATUS "Haskell package '${PACKAGE}' optionally required, but not found")
+      endif()
     endif()
   endif()
 endmacro()
--- a/gameServer/CMakeLists.txt	Mon Sep 12 12:50:37 2022 -0400
+++ b/gameServer/CMakeLists.txt	Mon Sep 12 12:51:41 2022 -0400
@@ -5,24 +5,24 @@
 
 include(${CMAKE_MODULE_PATH}/CheckHaskellPackageExists.cmake)
 
-check_haskell_package_exists(base "Control.Exception" mask 1)
-check_haskell_package_exists(containers "Data.Map" size 1)
-check_haskell_package_exists(vector "Data.Vector" length 1)
-check_haskell_package_exists(bytestring "Data.ByteString" pack 1)
-check_haskell_package_exists(network "Network.Socket" defaultHints 0)
-check_haskell_package_exists(network-bsd "Network.BSD" getHostName 0)
-check_haskell_package_exists(time "Data.Time" getCurrentTime 0)
-check_haskell_package_exists(mtl "Control.Monad.State" fix 1)
-check_haskell_package_exists(sandi "Codec.Binary.Base64" encode 1)
-check_haskell_package_exists(hslogger "System.Log.Logger" warningM 1)
-check_haskell_package_exists(process "System.Process" createProcess 3)
-check_haskell_package_exists(utf8-string "Data.ByteString.Lazy.UTF8" decode 1)
-check_haskell_package_exists(SHA "Data.Digest.Pure.SHA" sha1 1)
-check_haskell_package_exists(entropy "System.Entropy" openHandle 0)
-check_haskell_package_exists(zlib "Codec.Compression.Zlib" decompress 1)
-check_haskell_package_exists(random "System.Random" getStdGen 0)
-check_haskell_package_exists(regex-tdfa "Text.Regex.TDFA.ByteString" execute 2)
-check_haskell_package_exists(deepseq "Control.DeepSeq" deepseq 2)
+check_haskell_package_exists(base "Control.Exception" mask 1 REQUIRED)
+check_haskell_package_exists(containers "Data.Map" size 1 REQUIRED)
+check_haskell_package_exists(vector "Data.Vector" length 1 REQUIRED)
+check_haskell_package_exists(bytestring "Data.ByteString" pack 1 REQUIRED)
+check_haskell_package_exists(network "Network.Socket" defaultHints 0 REQUIRED)
+check_haskell_package_exists(network-bsd "Network.BSD" getHostName 0 OPTIONAL)
+check_haskell_package_exists(time "Data.Time" getCurrentTime 0 REQUIRED)
+check_haskell_package_exists(mtl "Control.Monad.State" fix 1 REQUIRED)
+check_haskell_package_exists(sandi "Codec.Binary.Base64" encode 1 REQUIRED)
+check_haskell_package_exists(hslogger "System.Log.Logger" warningM 1 REQUIRED)
+check_haskell_package_exists(process "System.Process" createProcess 3 REQUIRED)
+check_haskell_package_exists(utf8-string "Data.ByteString.Lazy.UTF8" decode 1 REQUIRED)
+check_haskell_package_exists(SHA "Data.Digest.Pure.SHA" sha1 1 REQUIRED)
+check_haskell_package_exists(entropy "System.Entropy" openHandle 0 REQUIRED)
+check_haskell_package_exists(zlib "Codec.Compression.Zlib" decompress 1 REQUIRED)
+check_haskell_package_exists(random "System.Random" getStdGen 0 REQUIRED)
+check_haskell_package_exists(regex-tdfa "Text.Regex.TDFA.ByteString" execute 2 REQUIRED)
+check_haskell_package_exists(deepseq "Control.DeepSeq" deepseq 2 REQUIRED)