diff --git a/CMakeLists.txt b/CMakeLists.txt index 10e2733c0..aed9ac8af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -241,9 +241,13 @@ IF(CMAKE_COMPILER_IS_GNUCXX) # but everything here is C++ code. # -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG # returns too many hits. - # # FYI, if we do implement GNUCC, then -Wmissing-prototypes in another + # FYI, if we do implement GNUCC, then -Wmissing-prototypes in another # interesting C-specific flag. - SET(OSG_AGGRESSIVE_WARNING_FLAGS "-Wall -Wparentheses -Wformat=2 -Wno-long-long -Wno-import -pedantic -Wnewline-eof -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused") + # Also, there is a bug in gcc 4.0. Under C++, -pedantic will create + # errors instead of warnings for certain issues, including superfluous + # semicolons and commas, and the use of long long. -fpermissive seems + # to be the workaround. + SET(OSG_AGGRESSIVE_WARNING_FLAGS "-Wall -Wparentheses -Wformat=2 -Wno-long-long -Wno-import -pedantic -Wnewline-eof -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive") ELSE(CMAKE_COMPILER_IS_GNUCXX) IF(MSVC) # FIXME: What are good aggressive warning flags for Visual Studio? diff --git a/CMakeModules/FindOpenThreads.cmake b/CMakeModules/FindOpenThreads.cmake index 64ce3142e..224dce909 100644 --- a/CMakeModules/FindOpenThreads.cmake +++ b/CMakeModules/FindOpenThreads.cmake @@ -25,7 +25,9 @@ FIND_PATH(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread ${CMAKE_INSTALL_PREFIX}/include $ENV{OPENTHREADS_DIR}/include + $ENV{OPENTHREADS_DIR} $ENV{OSG_DIR}/include + $ENV{OSG_DIR} ~/Library/Frameworks /Library/Frameworks /usr/local/include @@ -42,8 +44,12 @@ FIND_LIBRARY(OPENTHREADS_LIBRARY NAMES OpenThreads OpenThreadsWin32 PATHS ${CMAKE_INSTALL_PREFIX}/lib + $ENV{OPENTHREADS_DIR}/lib64 $ENV{OPENTHREADS_DIR}/lib + $ENV{OPENTHREADS_DIR} + $ENV{OSG_DIR}/lib64 $ENV{OSG_DIR}/lib + $ENV{OSG_DIR} ~/Library/Frameworks /Library/Frameworks /usr/local/lib64 @@ -60,8 +66,12 @@ FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG NAMES OpenThreadsd OpenThreadsWin32d PATHS ${CMAKE_INSTALL_PREFIX}/lib + $ENV{OPENTHREADS_DIR}/lib64 $ENV{OPENTHREADS_DIR}/lib + $ENV{OPENTHREADS_DIR} + $ENV{OSG_DIR}/lib64 $ENV{OSG_DIR}/lib + $ENV{OSG_DIR} ~/Library/Frameworks /Library/Frameworks /usr/local/lib64 @@ -75,14 +85,17 @@ FIND_LIBRARY(OPENTHREADS_LIBRARY_DEBUG [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib ) -SET(OPENTHREADS_FOUND "NO") -IF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY) - SET(OPENTHREADS_FOUND "YES") - # MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY}) +IF(OPENTHREADS_LIBRARY) IF(NOT OPENTHREADS_LIBRARY_DEBUG) #MESSAGE("-- Warning Debug OpenThreads not found, using: ${OPENTHREADS_LIBRARY}") #SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}") SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}" CACHE FILEPATH "Debug version of OpenThreads Library (use regular version if not available)" FORCE) ENDIF(NOT OPENTHREADS_LIBRARY_DEBUG) +ENDIF(OPENTHREADS_LIBRARY) + +SET(OPENTHREADS_FOUND "NO") +IF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY) + SET(OPENTHREADS_FOUND "YES") + # MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY}) ENDIF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY)