From b405bd47d02f57a46b6ced2ca17e5d42973d08e6 Mon Sep 17 00:00:00 2001 From: Florent Rougon <f.rougon@free.fr> Date: Thu, 11 Apr 2019 22:01:10 +0200 Subject: [PATCH] Use the system CppUnit only when -DSYSTEM_CPPUNIT=ON is passed to CMake According to the discussion around [1], using the system CppUnit library is rarely useful but likely to cause problems (due to possible incompatibilities between versions); that is, unless people doing so really know what they are doing. For this reason, this commit changes the CMake config logic as follows: the system CppUnit library is now only used when explicitly asked for with -DSYSTEM_CPPUNIT=ON on the CMake command line. [1] https://sourceforge.net/p/flightgear/mailman/message/36636483/ --- CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bc05b110..4a435860c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,11 +156,6 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR if(HTS_ENGINE_FOUND) set(SYSTEM_HTS_ENGINE_DEFAULT 1) endif() - - find_package(CppUnit) - if (CPPUNIT_FOUND) - set(SYSTEM_CPPUNIT_DEFAULT 1) - endif() endif() # FlightGear build options @@ -181,7 +176,7 @@ option(SYSTEM_SPEEX "Set to ON to build IAXClient with the system's speex a option(SYSTEM_GSM "Set to ON to build IAXClient with the system's GSM library" ${SYSTEM_GSM_DEFAULT}) option(SYSTEM_FLITE "Set to ON to build Flightgear with the system's Flite library" ${SYSTEM_FLITE_DEFAULT}) option(SYSTEM_HTS_ENGINE "Set to ON to build Flightgear with the system's HTS Engine library" ${SYSTEM_HTS_ENGINE_DEFAULT}) -option(SYSTEM_CPPUNIT "Set to ON to build Flightgear with the system's CppUnit library" ${SYSTEM_CPPUNIT_DEFAULT}) +option(SYSTEM_CPPUNIT "Set to ON to build Flightgear with the system's CppUnit library") # additional utilities option(ENABLE_FGELEV "Set to ON to build the fgelev application (default)" ON) @@ -279,6 +274,10 @@ if (ENABLE_SWIFT) endif() endif() +if (SYSTEM_CPPUNIT) + find_package(CppUnit REQUIRED) +endif() + # check required dependencies find_package(Boost REQUIRED) find_package(OpenGL REQUIRED)