Revision: 61554
          http://sourceforge.net/p/brlcad/code/61554
Author:   starseeker
Date:     2014-07-02 20:21:23 +0000 (Wed, 02 Jul 2014)
Log Message:
-----------
Grr - *still* not working.  Now it's ignoring gnu99 during release builds.

Modified Paths:
--------------
    brlcad/trunk/CMakeLists.txt
    brlcad/trunk/misc/CMake/BRLCAD_CheckFunctions.cmake

Modified: brlcad/trunk/CMakeLists.txt
===================================================================
--- brlcad/trunk/CMakeLists.txt 2014-07-02 20:01:44 UTC (rev 61553)
+++ brlcad/trunk/CMakeLists.txt 2014-07-02 20:21:23 UTC (rev 61554)
@@ -1987,23 +1987,33 @@
 endif("${HAVE_PROGRAM_INVOCATION_NAME}" MATCHES 
"^${HAVE_PROGRAM_INVOCATION_NAME}$")
 
 # test for lrint
-set(lrint_test "#include <math.h>\nint main() {return lrint(3.14);}")
-# this second test is mainly a test for BRLCAD_FUNCTION_EXISTS - can go away
-# once behavior of the macro is solid
-set(lrint_test_negative "#include <math.h>\nint main() {return lrint(-1);}")
-BRLCAD_FUNCTION_EXISTS(lrint HAVE_LRINT
-  COMPILE_TEST_SRCS lrint_test lrint_test_negative
-  REQUIRED_LIBS ${M_LIBRARY})
-if(NOT HAVE_LRINT AND "${HAVE_LRINT_WORKING_MACRO}" MATCHES 
"^${HAVE_LRINT_WORKING_MACRO}$")
+set(CMAKE_REQUIRED_LIBRARIES_BAK ${CMAKE_REQUIRED_LIBRARIES})
+set(CMAKE_REQUIRED_LIBRARIES ${M_LIBRARY})
+BRLCAD_FUNCTION_EXISTS(lrint HAVE_LRINT)
+if("${HAVE_LRINT}" MATCHES "^${HAVE_LRINT}$")
+  check_c_source_compiles("#include <math.h>\nint main() {return 
lrint(3.14);}" HAVE_LRINT_COMPILE)
+  if(HAVE_LRINT_COMPILE)
+    CONFIG_H_APPEND(BRLCAD "#cmakedefine HAVE_LRINT 1\n")
+  else(HAVE_LRINT_COMPILE)
     check_c_source_compiles("#include 
\"${CMAKE_CURRENT_SOURCE_DIR}/misc/CMake/test_srcs/lrint_macro.h\"\n#include 
<math.h>\nint main() {return lrint(3.14);}" HAVE_WORKING_LRINT_MACRO)
     if(HAVE_WORKING_LRINT_MACRO)
       CONFIG_H_APPEND(BRLCAD "#cmakedefine HAVE_WORKING_LRINT_MACRO 1\n")
     endif(HAVE_WORKING_LRINT_MACRO)
-endif(NOT HAVE_LRINT AND "${HAVE_LRINT_WORKING_MACRO}" MATCHES 
"^${HAVE_LRINT_WORKING_MACRO}$")
+  endif(HAVE_LRINT_COMPILE)
+endif("${HAVE_LRINT}" MATCHES "^${HAVE_LRINT}$")
+set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BAK})
 
 # test for tgamma
-set(tgamma_test "#include <math.h>\nint main() {double tga = tgamma(3.14); 
return 0;}")
-BRLCAD_FUNCTION_EXISTS(tgamma HAVE_TGAMMA COMPILE_TEST_SRCS tgamma_test 
REQUIRED_LIBS ${M_LIBRARY})
+BRLCAD_FUNCTION_EXISTS(tgamma HAVE_TGAMMA)
+if("${HAVE_TGAMMA}" MATCHES "^${HAVE_TGAMMA}$")
+  set(CMAKE_REQUIRED_LIBRARIES_BAK ${CMAKE_REQUIRED_LIBRARIES})
+  set(CMAKE_REQUIRED_LIBRARIES ${M_LIBRARY})
+  check_c_source_compiles("#include <math.h>\nint main() {double tga = 
tgamma(3.14); return 0;}" HAVE_TGAMMA)
+  if(HAVE_TGAMMA)
+    CONFIG_H_APPEND(BRLCAD "#cmakedefine HAVE_TGAMMA 1\n")
+  endif(HAVE_TGAMMA)
+  set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BAK})
+endif("${HAVE_TGAMMA}" MATCHES "^${HAVE_TGAMMA}$")
 
 #-----------------------------------------------------------------------
 # check C99 and POSIX 200112L missing functions with a more

Modified: brlcad/trunk/misc/CMake/BRLCAD_CheckFunctions.cmake
===================================================================
--- brlcad/trunk/misc/CMake/BRLCAD_CheckFunctions.cmake 2014-07-02 20:01:44 UTC 
(rev 61553)
+++ brlcad/trunk/misc/CMake/BRLCAD_CheckFunctions.cmake 2014-07-02 20:21:23 UTC 
(rev 61554)
@@ -36,7 +36,6 @@
 # Automate putting variables from tests into a config.h.in file,
 # and otherwise wrap check macros in extra logic as needed
 
-include(CMakeParseArguments)
 include(CheckFunctionExists)
 include(CheckIncludeFile)
 include(CheckIncludeFiles)
@@ -52,87 +51,13 @@
 # HAVE_* define to config header.
 ###
 macro(BRLCAD_FUNCTION_EXISTS function var)
-  if("${var}" MATCHES "^${var}$")
-    set(CMAKE_C_FLAGS_TMP "${CMAKE_C_FLAGS}")
-    set(CMAKE_C_FLAGS "")
-    if(${ARGC} GREATER 2)
-      # Parse extra arguments
-      CMAKE_PARSE_ARGUMENTS(${var} "" "" 
"COMPILE_TEST_SRCS;REQUIRED_LIBS;REQUIRED_DEFS;REQUIRED_FLAGS;REQUIRED_DIRS" 
${ARGN})
-      if(NOT "${${var}_REQUIRED_LIBS}" STREQUAL "")
-       set(CMAKE_REQUIRED_LIBRARIES_BAK ${CMAKE_REQUIRED_LIBRARIES})
-       set(CMAKE_REQUIRED_LIBRARIES ${${var}_REQUIRED_LIBS})
-      endif(NOT "${${var}_REQUIRED_LIBS}" STREQUAL "")
-
-      if(NOT "${${var}_REQUIRED_FLAGS}" STREQUAL "")
-       set(CMAKE_REQUIRED_FLAGS_BAK ${CMAKE_REQUIRED_FLAGS})
-       set(CMAKE_REQUIRED_FLAGS ${${var}_REQUIRED_FLAGS})
-      endif(NOT "${${var}_REQUIRED_FLAGS}" STREQUAL "")
-
-      if(NOT "${${var}_REQUIRED_DIRS}" STREQUAL "")
-       set(CMAKE_REQUIRED_INCLUDES_BAK ${CMAKE_REQUIRED_INCLUDES})
-       set(CMAKE_REQUIRED_INCLUDES ${${var}_REQUIRED_DIRS})
-      endif(NOT "${${var}_REQUIRED_DIRS}" STREQUAL "")
-
-      if(NOT "${${var}_REQUIRED_DEFS}" STREQUAL "")
-       set(CMAKE_REQUIRED_DEFINITIONS_BAK ${CMAKE_REQUIRED_DEFINITIONS})
-       set(CMAKE_REQUIRED_DEFINITIONS ${${var}_REQUIRED_DEFS})
-      endif(NOT "${${var}_REQUIRED_DEFS}" STREQUAL "")
-    endif(${ARGC} GREATER 2)
-
-    CHECK_FUNCTION_EXISTS(${function} ${var}_EXISTS)
-
-    # Restore required vars - this is done before any possible compilation 
tests,
-    # since the presumption is that the function must succeed in the parent
-    # compilation environment, not just in isolated testing.  (In particular,
-    # if -Werror is active that needs to be a failure.
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_TMP}")
-
-    if(${var}_EXISTS) 
-      if(NOT "${${var}_COMPILE_TEST_SRCS}" STREQUAL "")
-       set(${var}_COMPILE 1)
-       foreach(test_src ${${var}_COMPILE_TEST_SRCS})
-         check_c_source_compiles("${${test_src}}" ${var}_${test_src}_COMPILE)
-         if(NOT ${var}_${test_src}_COMPILE)
-           set(${var}_COMPILE 0)
-         endif(NOT ${var}_${test_src}_COMPILE)
-       endforeach(test_src ${${var}_COMPILE_TEST_SRCS})
-       if(${var}_COMPILE)
-         CONFIG_H_APPEND(BRLCAD "#cmakedefine ${var} 1\n")
-         set(${var} 1 CACHE INTERNAL "Have function ${function}")
-       else(${var}_COMPILE)
-         set(${var} "" CACHE INTERNAL "Function ${function} found but did not 
build.")
-       endif(${var}_COMPILE)
-      else(NOT "${${var}_COMPILE_TEST_SRCS}" STREQUAL "")
-       set(${var} 1 CACHE INTERNAL "Have function ${function}")
-      endif(NOT "${${var}_COMPILE_TEST_SRCS}" STREQUAL "")
-    else(${var}_EXISTS) 
-      set(${var} "" CACHE INTERNAL "Have function ${function}")
-    endif(${var}_EXISTS) 
-
-    if(CONFIG_H_FILE AND ${var})
-      CONFIG_H_APPEND(BRLCAD "#cmakedefine ${var} 1\n")
-    endif(CONFIG_H_FILE AND ${var})
-
-    if(${ARGC} GREATER 2)
-      if (${${var}_REQUIRED_LIBS})
-       set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BAK})
-      endif (${${var}_REQUIRED_LIBS})
-
-      if (${${var}_REQUIRED_FLAGS})
-       set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_BAK})
-      endif (${${var}_REQUIRED_FLAGS})
-
-      if (${${var}_REQUIRED_INCLUDES})
-       set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK})
-      endif (${${var}_REQUIRED_INCLUDES})
-    endif(${ARGC} GREATER 2)
-
-    # We used this variable for CHECK_FUNCTION_EXISTS to allow
-    # the additional specific src compile test as an option - ${var}
-    # is where the final result is cached.
-    unset(${var}_EXISTS CACHE)
-
-  endif("${var}" MATCHES "^${var}$")
+  set(CMAKE_C_FLAGS_TMP "${CMAKE_C_FLAGS}")
+  set(CMAKE_C_FLAGS "")
+  CHECK_FUNCTION_EXISTS(${function} ${var})
+  if(CONFIG_H_FILE AND ${var})
+    CONFIG_H_APPEND(BRLCAD "#cmakedefine ${var} 1\n")
+  endif(CONFIG_H_FILE AND ${var})
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_TMP}")
 endmacro(BRLCAD_FUNCTION_EXISTS)
 
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to