Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4560

The logic of CMAKE_DEPENDENT_OPTION seems wrong and can break the build

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: Build Process
    • Labels:
      None

      Description

      The cmake build uses CMAKE_DEPENDENT_OPTION in several places. But according to my understanding, the resulting logic is wrong and can lead to problems. Consider the following example for building with Qt4 or Qt5 from build/cmake/DefineOptions.cmake:

          find_package(Qt5 QUIET COMPONENTS Core Network)
          CMAKE_DEPENDENT_OPTION(WITH_QT5 "Build with Qt5 support" ON
                                 "Qt5_FOUND" OFF)
      

      If a user configures thrift with cmake -DWITH_QT5=ON but does not have Qt5 installed, they will not get an error. They will just get a warning that the option WITH_QT5 was unused.
      Furthermore, if the user disables Qt5 (i.e. because its broken), then cmake -DWITH_QT5=OFF will *not* disable the search for Qt5. If the find_package(Qt5 QUIET COMPONENTS Core Network) fails in error, the build will fail, despite the explicit request for cmake -DWITH_QT5=OFF.

      My expected behavior is that if WITH_QT5=OFF is specified, that no Qt5 checks are run and that a missing/broken Qt5 would not impact thrift in any way.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jking3 James E. King III
                Reporter:
                emmenlau Mario Emmenlauer
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: