Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1246 - in trunk: CMake scenes/galileo
- Date: Tue, 5 Dec 2006 16:53:04 -0700 (MST)
Author: bigler
Date: Tue Dec 5 16:53:03 2006
New Revision: 1246
Modified:
trunk/CMake/FindParsers.cmake
trunk/scenes/galileo/CMakeLists.txt
Log:
CMake/FindParsers.cmake
Redid things to make it behave a bit better with respect to finding
or not finding flex and bison as well as the version.
BISON_EXECUTABLE and FLEX_EXECUTABLE are now cached variables found
in the advanced section of CMake.
scenes/galileo/CMakeLists.txt
Restructured to only do any of the parsing stuff if you have enabled
the scene (fixes a bug in the previous version).
If you can't find the parsing stuff, report an error and prevent the
user from generating the build files until either the errors are
resolved or the scene is disabled.
Modified: trunk/CMake/FindParsers.cmake
==============================================================================
--- trunk/CMake/FindParsers.cmake (original)
+++ trunk/CMake/FindParsers.cmake Tue Dec 5 16:53:03 2006
@@ -1,22 +1,45 @@
SET(PARSERS_FOUND FOOBAR)
-FIND_PROGRAM(BISON_EXECUTABLE
- NAMES bison
- PATHS ${BISON_DIR} )
-
-FIND_PROGRAM(FLEX_EXECUTABLE
- NAMES flex
- PATHS ${FLEX_DIR} )
-
-IF(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
- SET(PARSERS_FOUND 1)
-ELSE(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
- SET(PARSERS_FOUND 0)
-ENDIF(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
+
+# These variables need to be specified in order to get CMake not to
+# barf on the IF(EXISTS ${BISON_EXECUTABLE} ..) expression even though
+# the code shouldn't get called. By setting them to BISON_EXECUTABLE
+
+SET(BISON_EXECUTABLE "BISON_EXECUTABLE-NOTFOUND" CACHE FILEPATH "bison
executable")
+SET(FLEX_EXECUTABLE "FLEX_EXECUTABLE-NOTFOUND" CACHE FILEPATH "flex
executable")
+# Mark these variables as advanced options
+MARK_AS_ADVANCED(FORCE BISON_EXECUTABLE)
+MARK_AS_ADVANCED(FORCE FLEX_EXECUTABLE)
# You need at least version 2.4 for this to work.
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
MESSAGE("You need at least version 2.4 for generating flex and bison
parsers. Go get it from
http://www.cmake.org/HTML/Download.html")
SET(PARSERS_FOUND 0)
+
+ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
+
+ FIND_PROGRAM(BISON_EXECUTABLE
+ NAMES bison
+ PATHS ${BISON_DIR} )
+
+ FIND_PROGRAM(FLEX_EXECUTABLE
+ NAMES flex
+ PATHS ${FLEX_DIR} )
+
+ IF(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
+ SET(PARSERS_FOUND 1)
+
+ ELSE(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
+ SET(PARSERS_FOUND 0)
+ # Print some error messages to the user
+ IF (NOT EXISTS ${BISON_EXECUTABLE})
+ MESSAGE("Couldn't find bison executable. Please check value in
BISON_EXECUTABLE in advanced settings.")
+ ENDIF (NOT EXISTS ${BISON_EXECUTABLE})
+ IF (NOT EXISTS ${FLEX_EXECUTABLE})
+ MESSAGE("Couldn't find flex executable. Please check value in
FLEX_EXECUTABLE in advanced settings.")
+ ENDIF (NOT EXISTS ${FLEX_EXECUTABLE})
+
+ ENDIF(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
+
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
# These are helper functions for parsers.
Modified: trunk/scenes/galileo/CMakeLists.txt
==============================================================================
--- trunk/scenes/galileo/CMakeLists.txt (original)
+++ trunk/scenes/galileo/CMakeLists.txt Tue Dec 5 16:53:03 2006
@@ -2,19 +2,24 @@
SET(SCENE_GALILEO 0 CACHE BOOL "Galileo scene reader")
IF(SCENE_GALILEO)
+ # Only look for the parsers if the Galileo scene is specified
INCLUDE(${CMAKE_SOURCE_DIR}/CMake/FindParsers.cmake)
-ENDIF(SCENE_GALILEO)
-GENERATE_BISON_FLEX_SOURCES(${CMAKE_CURRENT_SOURCE_DIR}/grparse.y ""
- ${CMAKE_CURRENT_SOURCE_DIR}/grlex.l "")
-MESSAGE("BF_SOURCES = ${BF_SOURCES}")
+ IF(PARSERS_FOUND)
+
+ GENERATE_BISON_FLEX_SOURCES(${CMAKE_CURRENT_SOURCE_DIR}/grparse.y ""
+ ${CMAKE_CURRENT_SOURCE_DIR}/grlex.l "")
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}
- )
+ INCLUDE_DIRECTORIES(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
-IF(SCENE_GALILEO AND PARSERS_FOUND)
- ADD_LIBRARY(scene_galileo galileo.cc ${BF_SOURCES})
- TARGET_LINK_LIBRARIES(scene_galileo ${MANTA_SCENE_LINK})
-ENDIF(SCENE_GALILEO AND PARSERS_FOUND)
+ ADD_LIBRARY(scene_galileo galileo.cc ${BF_SOURCES})
+ TARGET_LINK_LIBRARIES(scene_galileo ${MANTA_SCENE_LINK})
+
+ ELSE(PARSERS_FOUND)
+ # Opps, didn't find the parsers
+ MESSAGE(SEND_ERROR "Galileo scene build is specified, but either CMake
isn't new enough or the parsing tools can't be found.\n\nIf you can't get it
configured turn off the SCENE_GALILEO variable.")
+ ENDIF(PARSERS_FOUND)
+ENDIF(SCENE_GALILEO)
- [MANTA] r1246 - in trunk: CMake scenes/galileo, bigler, 12/05/2006
Archive powered by MHonArc 2.6.16.