diff cmake/FindD.cmake @ 402:e67ce7c21758

gdc & 64 bit changes
author Eldar Insafutdinov
date Thu, 17 Mar 2011 19:45:42 +0000
parents d2f48c4cb3e3
children 8564ab82ea42
line wrap: on
line diff
--- a/cmake/FindD.cmake	Wed Oct 20 09:45:59 2010 +0200
+++ b/cmake/FindD.cmake	Thu Mar 17 19:45:42 2011 +0000
@@ -3,20 +3,20 @@
 ##--------------------------------------------
 
 ## Find D compiler and parse its version.
-find_program(DC NAMES dmd ldc)
+find_program(DC NAMES dmd ldc gdmd)
 if (DC)
     get_filename_component(dc_path ${DC} PATH)
     if("${dc_path}" STREQUAL ${CMAKE_BINARY_DIR})
-	get_filename_component(DC ${DC} NAME)
+        get_filename_component(DC ${DC} NAME)
     endif("${dc_path}" STREQUAL ${CMAKE_BINARY_DIR})
     exec_program(${DC} ARGS "" OUTPUT_VARIABLE d_output)
     string(REGEX MATCH "Digital Mars D Compiler v[0-9]\\.[0-9]+" dmd_version "${d_output}")
     if (dmd_version)
-	set(D_IS_MARS true)
-	set(D_IS_DMD true)
-	set(D_COMPILER_NAME "Digital Mars D Compiler")
-	string(REGEX REPLACE "Digital Mars D Compiler v([0-9])\\.[0-9]+" "\\1" D_VERSION "${dmd_version}")
-	string(REGEX REPLACE "Digital Mars D Compiler v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${dmd_version}")
+        set(D_IS_MARS true)
+        set(D_IS_DMD true)
+        set(D_COMPILER_NAME "Digital Mars D Compiler")
+        string(REGEX REPLACE "Digital Mars D Compiler v([0-9])\\.[0-9]+" "\\1" D_VERSION "${dmd_version}")
+        string(REGEX REPLACE "Digital Mars D Compiler v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${dmd_version}")
     else (dmd_version)
 	string(REGEX MATCH "LLVM-based D Compiler" is_ldc "${d_output}")
 	if (is_ldc)
@@ -33,8 +33,14 @@
 		message(FATAL_ERROR "LDC compiler found, but the version can not be processed")
 	    endif(ldc_version)
 	else (is_ldc)
-	    message(FATAL_ERROR "D compiler is not found")
-	endif(is_ldc)
+    string(REGEX MATCH "gdc" is_gdc "${d_output}")
+    if(is_gdc)
+        set(D_COMPILER_NAME "GDC-based D Compiler")
+        set(D_VERSION 2)
+    else(is_gdc)
+        message(FATAL_ERROR "D compiler is not found")
+    endif(is_gdc)
+    endif(is_ldc)
     endif(dmd_version)
     message(STATUS "D compiler found -- ${D_COMPILER_NAME} v${D_VERSION}.${D_FRONTEND}")
 else (DC)