diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-03-17 20:46:20 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-03-17 20:46:20 (GMT) |
commit | b20cb780495630fa8088f9c95309597af22734c1 (patch) | |
tree | 2747cff8befd423ac960dcec3caab1dc3ed121e4 /Source/CMakeLists.txt | |
parent | ca8d1bc99b68f39fb24e76ac1a546e7849248771 (diff) | |
download | CMake-b20cb780495630fa8088f9c95309597af22734c1.zip CMake-b20cb780495630fa8088f9c95309597af22734c1.tar.gz CMake-b20cb780495630fa8088f9c95309597af22734c1.tar.bz2 |
ENH: Handle missing unsetenv and add check for environ
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r-- | Source/CMakeLists.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f176751..af259a5 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -23,6 +23,23 @@ INCLUDE_DIRECTORIES( # let cmake know it is supposed to use it ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE) +INCLUDE(CheckSymbolExists) +CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) +INCLUDE("${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake") +CHECK_CXX_SOURCE_COMPILES( + "int main(int argc, char* argv[]) { return sizeof(environ); }" + HAVE_ENVIRON_WITHOUT_SIGNATURE) +IF(NOT HAVE_ENVIRON_WITHOUT_SIGNATURE) + CHECK_CXX_SOURCE_COMPILES( + " + #ifdef _WIN32 + extern __declspec( dllimport ) char** environ; + #else + extern char** environ; + #endif + int main(int argc, char* argv[]) { return sizeof(environ); }" + HAVE_ENVIRON_WITH_SIGNATURE) +ENDIF(NOT HAVE_ENVIRON_WITHOUT_SIGNATURE) OPTION(CMAKE_REGENERATE_YACCLEX "Regenerate YACC and LEXX files" OFF) |