]> granicus.if.org Git - graphviz/commitdiff
CMake: make all glcomp checks required if 'with_smyrna=ON'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 22 Mar 2022 14:43:27 +0000 (07:43 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 29 Mar 2022 23:43:45 +0000 (16:43 -0700)
Given there is a build system flag `with_smyrna` that defaults to `OFF`, it
seems to make more sense to unconditionally attempt to build glcomp when this
flag is on. The current silent disabling behavior when dependencies are missing
results in a confusing link failure when glcomp cannot be found. Following this
change, this is instead a configuration failure pointing to the missing
dependency(ies).

lib/glcomp/CMakeLists.txt

index 89ea35c843df68be0e27920f50bc07518be6d193..4e221618d89e73b296b755d87fa41972d4525e24 100644 (file)
@@ -1,66 +1,61 @@
 if(with_smyrna)
 
-  find_package(Freetype)
-  find_package(GLUT)
-  find_package(GTK2 COMPONENTS gtk glade)
-  find_package(PANGOCAIRO)
-  find_package(PkgConfig)
+  find_package(Freetype REQUIRED)
+  find_package(GLUT REQUIRED)
+  find_package(GTK2 REQUIRED COMPONENTS gtk glade)
+  find_package(PANGOCAIRO REQUIRED)
+  find_package(PkgConfig REQUIRED)
   if(PKG_CONFIG_FOUND)
-    pkg_check_modules(XRENDER xrender)
+    pkg_check_modules(XRENDER REQUIRED xrender)
   endif()
 
-  if(Freetype_FOUND AND GLUT_FOUND AND GTK2_FOUND AND PANGOCAIRO_FOUND
-     AND XRENDER_FOUND)
-
-    add_library(glcomp
-      glcompbutton.h
-      glcompdefs.h
-      glcompfont.h
-      glcompimage.h
-      glcomplabel.h
-      glcompmouse.h
-      glcomppanel.h
-      glcompset.h
-      glcomptextpng.h
-      glcomptexture.h
-      glpangofont.h
-      glutils.h
-
-      glcompbutton.c
-      glcompfont.c
-      glcompimage.c
-      glcomplabel.c
-      glcompmouse.c
-      glcomppanel.c
-      glcompset.c
-      glcomptextpng.c
-      glcomptexture.c
-      glpangofont.c
-      glutils.c
-    )
-
-    target_include_directories(glcomp PRIVATE
-      ${GRAPHVIZ_LIB_DIR}
-      ${GRAPHVIZ_LIB_DIR}/common
-    )
-
-    target_include_directories(glcomp SYSTEM PRIVATE
-      ${Freetype_INCLUDE_DIRS}
-      ${GLUT_INCLUDE_DIRS}
-      ${GTK2_INCLUDE_DIRS}
-      ${PANGOCAIRO_INCLUDE_DIRS}
-      ${XRENDER_INCLUDE_DIRS}
-    )
-
-    target_link_libraries(glcomp PRIVATE
-      ${Freetype_LIBRARIES}
-      ${GLUT_LIBRARIES}
-      ${GTK2_LIBRARIES}
-      ${MATH_LIB}
-      ${PANGOCAIRO_LIBRARIES}
-      ${XRENDER_LIBRARIES}
-    )
-
-  endif()
+  add_library(glcomp
+    glcompbutton.h
+    glcompdefs.h
+    glcompfont.h
+    glcompimage.h
+    glcomplabel.h
+    glcompmouse.h
+    glcomppanel.h
+    glcompset.h
+    glcomptextpng.h
+    glcomptexture.h
+    glpangofont.h
+    glutils.h
+
+    glcompbutton.c
+    glcompfont.c
+    glcompimage.c
+    glcomplabel.c
+    glcompmouse.c
+    glcomppanel.c
+    glcompset.c
+    glcomptextpng.c
+    glcomptexture.c
+    glpangofont.c
+    glutils.c
+  )
+
+  target_include_directories(glcomp PRIVATE
+    ${GRAPHVIZ_LIB_DIR}
+    ${GRAPHVIZ_LIB_DIR}/common
+  )
+
+  target_include_directories(glcomp SYSTEM PRIVATE
+    ${Freetype_INCLUDE_DIRS}
+    ${GLUT_INCLUDE_DIRS}
+    ${GTK2_INCLUDE_DIRS}
+    ${PANGOCAIRO_INCLUDE_DIRS}
+    ${XRENDER_INCLUDE_DIRS}
+  )
+
+  target_link_libraries(glcomp PRIVATE
+    ${Freetype_LIBRARIES}
+    ${GLUT_LIBRARIES}
+    ${GTK2_LIBRARIES}
+    ${MATH_LIB}
+    ${PANGOCAIRO_LIBRARIES}
+    ${XRENDER_LIBRARIES}
+  )
 
 endif()