-PROJECT(madmutt C)
+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+
+PROJECT(madmutt C D)
SET(PACKAGE madmutt)
-SET(CMAKE_MODULE_PATH ${madmutt_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
-# TODO {{{
-# USE_SETGID
-# }}}
+# Using Phobos OR Tango (can be specified from cmake command line)
+if (NOT CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_USE_TANGO)
+ # default to phobos
+ message(STATUS "This application can be built with either Phobos or Tango!")
+ message(STATUS "You did not specify a standard library -- defaulting to Phobos.")
+ message(STATUS "If you wish to use Tango add -DCMAKE_D_USE_TANGO=True to cmake command line.")
+ set(CMAKE_D_USE_PHOBOS True)
+endif (NOT CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_USE_TANGO)
INCLUDE(CMakeDetermineCCompiler)
include(Cpkg2c)
--- /dev/null
+#\r
+# CMakeD - CMake module for D Language\r
+#\r
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>\r
+# Tim Burrell <tim.burrell@gmail.com>\r
+#\r
+# All rights reserved. \r
+#\r
+# See Copyright.txt for details.\r
+#\r
+# Modified from CMake 2.6.5 CMakeCCompiler.cmake.in\r
+# See http://www.cmake.org/HTML/Copyright.html for details\r
+# \r
+\r
+SET(CMAKE_D_COMPILER "@CMAKE_D_COMPILER@")\r
+SET(CMAKE_D_COMPILER_ARG1 "@CMAKE_D_COMPILER_ARG1@")\r
+SET(CMAKE_AR "@CMAKE_AR@")\r
+SET(CMAKE_RANLIB "@CMAKE_RANLIB@")\r
+SET(CMAKE_COMPILER_IS_GDC @CMAKE_COMPILER_IS_GDC@)\r
+SET(CMAKE_COMPILER_IS_DMD @CMAKE_COMPILER_IS_DMD@)\r
+SET(CMAKE_D_COMPILER_LOADED 1)\r
+SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)\r
+SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)\r
+IF(CMAKE_COMPILER_IS_CYGWIN)\r
+ SET(CYGWIN 1)\r
+ SET(UNIX 1)\r
+ENDIF(CMAKE_COMPILER_IS_CYGWIN)\r
+\r
+SET(CMAKE_D_COMPILER_ENV_VAR "DC")\r
+\r
+IF(CMAKE_COMPILER_IS_MINGW)\r
+ SET(MINGW 1)\r
+ENDIF(CMAKE_COMPILER_IS_MINGW)\r
+SET(CMAKE_COMPILER_IS_GDC_RUN 1)\r
+SET(CMAKE_D_SOURCE_FILE_EXTENSIONS d)\r
+SET(CMAKE_D_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)\r
+SET(CMAKE_D_LINKER_PREFERENCE None)\r
+IF(UNIX)\r
+ SET(CMAKE_D_OUTPUT_EXTENSION .o)\r
+ELSE(UNIX)\r
+ SET(CMAKE_D_OUTPUT_EXTENSION .obj)\r
+ENDIF(UNIX)\r
+# save the size of void* in case where cache is removed\r
+# and the this file is still around\r
+#SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)\r
--- /dev/null
+#\r
+# CMakeD - CMake module for D Language\r
+#\r
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>\r
+# Tim Burrell <tim.burrell@gmail.com>\r
+#\r
+# All rights reserved.\r
+#\r
+# See Copyright.txt for details.\r
+#\r
+# Modified from CMake 2.6.5 CMakeCInformation.cmake\r
+# See http://www.cmake.org/HTML/Copyright.html for details\r
+#\r
+\r
+# This file sets the basic flags for the D language in CMake.\r
+# It also loads the available platform file for the system-compiler\r
+# if it exists.\r
+\r
+GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_D_COMPILER} NAME_WE)\r
+IF(CMAKE_COMPILER_IS_GDC)\r
+ SET(CMAKE_BASE_NAME gdc)\r
+ELSE(CMAKE_COMPILER_IS_GDC)\r
+ SET(CMAKE_BASE_NAME dmd)\r
+ENDIF(CMAKE_COMPILER_IS_GDC)\r
+SET(CMAKE_SYSTEM_AND_D_COMPILER_INFO_FILE \r
+ ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)\r
+INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)\r
+\r
+# This should be included before the _INIT variables are\r
+# used to initialize the cache. Since the rule variables \r
+# have if blocks on them, users can still define them here.\r
+# But, it should still be after the platform file so changes can\r
+# be made to those values.\r
+\r
+IF(CMAKE_USER_MAKE_RULES_OVERRIDE)\r
+ INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})\r
+ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)\r
+\r
+IF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)\r
+ INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_D})\r
+ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)\r
+\r
+# for most systems a module is the same as a shared library\r
+# so unless the variable CMAKE_MODULE_EXISTS is set just\r
+# copy the values from the LIBRARY variables\r
+IF(NOT CMAKE_MODULE_EXISTS)\r
+ SET(CMAKE_SHARED_MODULE_D_FLAGS ${CMAKE_SHARED_LIBRARY_D_FLAGS})\r
+ SET(CMAKE_SHARED_MODULE_CREATE_D_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS})\r
+ENDIF(NOT CMAKE_MODULE_EXISTS)\r
+\r
+SET (CMAKE_D_FLAGS "$ENV{CFLAGS} ${CMAKE_D_FLAGS_INIT}" CACHE STRING\r
+ "Flags for D compiler.")\r
+\r
+IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)\r
+# default build type is none\r
+ IF(NOT CMAKE_NO_BUILD_TYPE)\r
+ SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING \r
+ "Choose the type of build, options are: None(CMAKE_D_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")\r
+ ENDIF(NOT CMAKE_NO_BUILD_TYPE)\r
+ SET (CMAKE_D_FLAGS_DEBUG "${CMAKE_D_FLAGS_DEBUG_INIT}" CACHE STRING\r
+ "Flags used by the compiler during debug builds.")\r
+ SET (CMAKE_D_FLAGS_MINSIZEREL "${CMAKE_D_FLAGS_MINSIZEREL_INIT}" CACHE STRING\r
+ "Flags used by the compiler during release minsize builds.")\r
+ SET (CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE_INIT}" CACHE STRING\r
+ "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")\r
+ SET (CMAKE_D_FLAGS_RELWITHDEBINFO "${CMAKE_D_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING\r
+ "Flags used by the compiler during Release with Debug Info builds.")\r
+ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)\r
+\r
+IF(CMAKE_D_STANDARD_LIBRARIES_INIT)\r
+ SET(CMAKE_D_STANDARD_LIBRARIES "${CMAKE_D_STANDARD_LIBRARIES_INIT}"\r
+ CACHE STRING "Libraries linked by defalut with all D applications.")\r
+ MARK_AS_ADVANCED(CMAKE_D_STANDARD_LIBRARIES)\r
+ENDIF(CMAKE_D_STANDARD_LIBRARIES_INIT)\r
+\r
+INCLUDE(CMakeCommonLanguageInclude)\r
+\r
+# now define the following rule variables\r
+\r
+# CMAKE_D_CREATE_SHARED_LIBRARY\r
+# CMAKE_D_CREATE_SHARED_MODULE\r
+# CMAKE_D_CREATE_STATIC_LIBRARY\r
+# CMAKE_D_COMPILE_OBJECT\r
+# CMAKE_D_LINK_EXECUTABLE\r
+\r
+# variables supplied by the generator at use time\r
+# <TARGET>\r
+# <TARGET_BASE> the target without the suffix\r
+# <OBJECTS>\r
+# <OBJECT>\r
+# <LINK_LIBRARIES>\r
+# <FLAGS>\r
+# <LINK_FLAGS>\r
+\r
+# D compiler information\r
+# <CMAKE_D_COMPILER> \r
+# <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS>\r
+# <CMAKE_SHARED_MODULE_CREATE_D_FLAGS>\r
+# <CMAKE_D_LINK_FLAGS>\r
+\r
+# Static library tools\r
+# <CMAKE_AR> \r
+# <CMAKE_RANLIB>\r
+\r
+IF("$ENV{D_PATH}" STREQUAL "")\r
+ STRING(LENGTH ${CMAKE_D_COMPILER} CMAKE_D_COMPILER_LENGTH)\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 12")\r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 8")\r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ STRING(SUBSTRING ${CMAKE_D_COMPILER} 0 ${CMAKE_D_COMPILER_LENGTH} D_PATH)\r
+ELSE("$ENV{D_PATH}" STREQUAL "")\r
+ SET(D_PATH "$ENV{D_PATH}")\r
+ENDIF("$ENV{D_PATH}" STREQUAL "")\r
+MESSAGE(STATUS "D Compiler Install Prefix (use D_PATH env var to override): ${D_PATH}")\r
+\r
+IF(CMAKE_COMPILER_IS_GDC)\r
+ SET(CMAKE_OUTPUT_D_FLAG "-o ")\r
+ SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")\r
+ SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")\r
+ SET(CMAKE_INCLUDE_FLAG_D "-I") # -I\r
+ SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty\r
+ SET(CMAKE_LIBRARY_PATH_FLAG "-L")\r
+ SET(CMAKE_LINK_LIBRARY_FLAG "-l")\r
+ SET(CMAKE_D_VERSION_FLAG "-fversion=")\r
+ELSE(CMAKE_COMPILER_IS_GDC)\r
+ SET(CMAKE_OUTPUT_D_FLAG "-of")\r
+ SET(CMAKE_D_VERSION_FLAG "-version=")\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ SET(CMAKE_INCLUDE_FLAG_D "-I") # -I\r
+ SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty\r
+ SET(CMAKE_LINK_LIBRARY_FLAG "-L+")\r
+ SET(CMAKE_LIBRARY_PATH_FLAG "-L+")\r
+ SET(CMAKE_LIBRARY_PATH_TERMINATOR "\\")\r
+ FIND_PROGRAM(DMD_LIBRARIAN "lib.exe")\r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")\r
+ SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")\r
+ SET(CMAKE_INCLUDE_FLAG_D "-I") # -I\r
+ SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty\r
+ SET(CMAKE_LIBRARY_PATH_FLAG "-L")\r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ENDIF(CMAKE_COMPILER_IS_GDC)\r
+
+IF(CMAKE_D_USE_TANGO)\r
+ IF(CMAKE_COMPILER_IS_GDC)\r
+ SET(DSTDLIB_TYPE "-fversion=Tango")\r
+ SET(DSTDLIB_FLAGS "-lgtango")\r
+ ELSE(CMAKE_COMPILER_IS_GDC)\r
+ SET(DSTDLIB_TYPE "-version=Tango")\r
+ SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos")\r
+ ENDIF(CMAKE_COMPILER_IS_GDC)\r
+ENDIF(CMAKE_D_USE_TANGO)\r
+IF(CMAKE_D_USE_PHOBOS)\r
+ IF(CMAKE_COMPILER_IS_GDC)\r
+ SET(DSTDLIB_TYPE "-fversion=Phobos")\r
+ SET(DSTDLIB_FLAGS "-lgphobos")\r
+ ELSE(CMAKE_COMPILER_IS_GDC)\r
+ SET(DSTDLIB_TYPE "-version=Phobos")\r
+ SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -lphobos")\r
+ ENDIF(CMAKE_COMPILER_IS_GDC)\r
+ENDIF(CMAKE_D_USE_PHOBOS)\r
+\r
+# create a D shared library\r
+IF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)\r
+ IF(CMAKE_COMPILER_IS_GDC)\r
+ SET(CMAKE_D_CREATE_SHARED_LIBRARY\r
+ "<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES>")\r
+ ELSE(CMAKE_COMPILER_IS_GDC)\r
+ SET(CMAKE_D_CREATE_SHARED_LIBRARY\r
+ "<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES> ${DSTDLIB_FLAGS}")\r
+ ENDIF(CMAKE_COMPILER_IS_GDC)\r
+ENDIF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)\r
+\r
+# create a D shared module just copy the shared library rule\r
+IF(NOT CMAKE_D_CREATE_SHARED_MODULE)\r
+ SET(CMAKE_D_CREATE_SHARED_MODULE ${CMAKE_D_CREATE_SHARED_LIBRARY})\r
+ENDIF(NOT CMAKE_D_CREATE_SHARED_MODULE)\r
+\r
+# create a D static library\r
+IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)\r
+ IF(CMAKE_COMPILER_IS_GDC)\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ SET(CMAKE_D_CREATE_STATIC_LIBRARY\r
+ "<CMAKE_AR> cr <TARGET>.lib <LINK_FLAGS> <OBJECTS> "\r
+ "<CMAKE_RANLIB> <TARGET>.lib "\r
+ "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "\r
+ "<CMAKE_RANLIB> <TARGET> "\r
+ )\r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ SET(CMAKE_D_CREATE_STATIC_LIBRARY\r
+ "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "\r
+ "<CMAKE_RANLIB> <TARGET> "\r
+ )\r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ ELSE(CMAKE_COMPILER_IS_GDC)\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")\r
+ SET(CMAKE_D_CREATE_STATIC_LIBRARY\r
+ "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>"\r
+ "<CMAKE_RANLIB> <TARGET>")\r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")\r
+ SET(CMAKE_D_CREATE_STATIC_LIBRARY\r
+ "${DMD_LIBRARIAN} -c -p256 <TARGET> <OBJECTS>")\r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")\r
+ ENDIF(CMAKE_COMPILER_IS_GDC) \r
+ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)\r
+\r
+# compile a D file into an object file\r
+IF(NOT CMAKE_D_COMPILE_OBJECT)\r
+ SET(CMAKE_D_COMPILE_OBJECT\r
+ "<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_OUTPUT_D_FLAG}<OBJECT> -c <SOURCE>")\r
+ENDIF(NOT CMAKE_D_COMPILE_OBJECT)\r
+\r
+IF(NOT CMAKE_D_LINK_EXECUTABLE)\r
+ IF(CMAKE_COMPILER_IS_GDC)\r
+ SET(CMAKE_D_LINK_EXECUTABLE\r
+ "<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES> ${DSTDLIB_FLAGS} ${DSTDLIB_TYPE}")\r
+ ELSE(CMAKE_COMPILER_IS_GDC)\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")\r
+ SET(CMAKE_D_LINK_EXECUTABLE\r
+ "gcc ${DLINK_FLAGS} <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -lpthread -lm ${DSTDLIB_FLAGS}")\r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")\r
+ SET(CMAKE_D_LINK_EXECUTABLE\r
+ "<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES>")\r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")\r
+ ENDIF(CMAKE_COMPILER_IS_GDC)\r
+ENDIF(NOT CMAKE_D_LINK_EXECUTABLE)\r
+\r
+MARK_AS_ADVANCED(\r
+CMAKE_D_FLAGS\r
+CMAKE_D_FLAGS_DEBUG\r
+CMAKE_D_FLAGS_MINSIZEREL\r
+CMAKE_D_FLAGS_RELEASE\r
+CMAKE_D_FLAGS_RELWITHDEBINFO\r
+)\r
+SET(CMAKE_D_INFORMATION_LOADED 1)\r
--- /dev/null
+#
+# CMakeD - CMake module for D Language
+#
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
+# Tim Burrell <tim.burrell@gmail.com>
+#
+# All rights reserved.
+#
+# See Copyright.txt for details.
+#
+# Modified from CMake 2.6.5 CMakeDetermineCCompiler.cmake
+# See http://www.cmake.org/HTML/Copyright.html for details
+#
+
+# determine the compiler to use for D programs
+# NOTE, a generator may set CMAKE_D_COMPILER before
+# loading this file to force a compiler.
+# use environment variable DC first if defined by user, next use
+# the cmake variable CMAKE_GENERATOR_D which can be defined by a generator
+# as a default compiler
+
+IF(NOT CMAKE_D_COMPILER)
+
+ # prefer the environment variable DC
+ IF($ENV{DC} MATCHES ".+")
+ GET_FILENAME_COMPONENT(CMAKE_D_COMPILER_INIT $ENV{DC} PROGRAM PROGRAM_ARGS CMAKE_D_FLAGS_ENV_INIT)
+ IF(CMAKE_D_FLAGS_ENV_INIT)
+ SET(CMAKE_D_COMPILER_ARG1 "${CMAKE_D_FLAGS_ENV_INIT}" CACHE STRING "First argument to D compiler")
+ ENDIF(CMAKE_D_FLAGS_ENV_INIT)
+ IF(EXISTS ${CMAKE_D_COMPILER_INIT})
+ ELSE(EXISTS ${CMAKE_D_COMPILER_INIT})
+ MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable C:\n$ENV{DC}.")
+ ENDIF(EXISTS ${CMAKE_D_COMPILER_INIT})
+ ENDIF($ENV{DC} MATCHES ".+")
+
+ # next try prefer the compiler specified by the generator
+ IF(CMAKE_GENERATOR_D)
+ IF(NOT CMAKE_D_COMPILER_INIT)
+ SET(CMAKE_D_COMPILER_INIT ${CMAKE_GENERATOR_D})
+ ENDIF(NOT CMAKE_D_COMPILER_INIT)
+ ENDIF(CMAKE_GENERATOR_D)
+
+ # finally list compilers to try
+ IF(CMAKE_D_COMPILER_INIT)
+ SET(CMAKE_D_COMPILER_LIST ${CMAKE_D_COMPILER_INIT})
+ ELSE(CMAKE_D_COMPILER_INIT)
+ SET(CMAKE_D_COMPILER_LIST gdc dmd)
+ ENDIF(CMAKE_D_COMPILER_INIT)
+
+ # Find the compiler.
+ FIND_PROGRAM(CMAKE_D_COMPILER NAMES ${CMAKE_D_COMPILER_LIST} DOC "C compiler")
+ IF(CMAKE_D_COMPILER_INIT AND NOT CMAKE_D_COMPILER)
+ SET(CMAKE_D_COMPILER "${CMAKE_D_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE)
+ ENDIF(CMAKE_D_COMPILER_INIT AND NOT CMAKE_D_COMPILER)
+ENDIF(NOT CMAKE_D_COMPILER)
+MARK_AS_ADVANCED(CMAKE_D_COMPILER)
+GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_D_COMPILER}" PATH)
+
+FIND_PROGRAM(CMAKE_AR NAMES ar PATHS ${COMPILER_LOCATION} )
+
+FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib)
+IF(NOT CMAKE_RANLIB)
+ SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
+ENDIF(NOT CMAKE_RANLIB)
+MARK_AS_ADVANCED(CMAKE_RANLIB)
+
+# do not test for GNU if the generator is visual studio
+IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+ SET(CMAKE_COMPILER_IS_GDC_RUN 1)
+ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+
+
+IF(NOT CMAKE_COMPILER_IS_GDC_RUN)
+ # test to see if the d compiler is gdc
+ SET(CMAKE_COMPILER_IS_GDC_RUN 1)
+ IF("${CMAKE_D_COMPILER}" MATCHES ".*gdc.*" )
+ SET(CMAKE_COMPILER_IS_GDC 1)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the D compiler is GDC succeeded with "
+ "the following output:\n${CMAKE_D_COMPILER}\n\n")
+ EXEC_PROGRAM(${CMAKE_D_COMPILER} ARGS "--version" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT)
+ IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*mingw.*" )
+ SET(CMAKE_COMPILER_IS_MINGW 1)
+ ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*mingw.*" )
+ IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
+ SET(CMAKE_COMPILER_IS_CYGWIN 1)
+ ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
+ ELSE("${CMAKE_D_COMPILER}" MATCHES ".*dmd.*" )
+ SET(CMAKE_COMPILER_IS_DMD 1)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the D compiler is DMD succeeded with "
+ "the following output:\n${CMAKE_D_COMPILER}\n\n")
+ ENDIF("${CMAKE_D_COMPILER}" MATCHES ".*gdc.*" )
+ENDIF(NOT CMAKE_COMPILER_IS_GDC_RUN)
+
+
+# configure variables set in this file for fast reload later on
+IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
+ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in
+ "${CMAKE_PLATFORM_ROOT_BIN}/CMakeDCompiler.cmake" IMMEDIATE)
+ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
+ CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in
+ "${CMAKE_PLATFORM_ROOT_BIN}/CMakeDCompiler.cmake" IMMEDIATE)
+ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
+
+MARK_AS_ADVANCED(CMAKE_AR)
+SET(CMAKE_D_COMPILER_ENV_VAR "DC")
+
--- /dev/null
+#\r
+# CMakeD - CMake module for D Language\r
+#\r
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>\r
+# Tim Burrell <tim.burrell@gmail.com>\r
+#\r
+# All rights reserved.\r
+#\r
+# See Copyright.txt for details.\r
+#\r
+# Modified from CMake 2.6.5 CMakeTestCCompiler.cmake\r
+# See http://www.cmake.org/HTML/Copyright.html for details\r
+#\r
+\r
+# This file is used by EnableLanguage in cmGlobalGenerator to\r
+# determine that that selected D compiler can actually compile\r
+# and link the most basic of programs. If not, a fatal error\r
+# is set and cmake stops processing commands and will not generate\r
+# any makefiles or projects.\r
+\r
+IF(NOT CMAKE_D_COMPILER_WORKS)\r
+ MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER}")\r
+ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ "int main(char[][] args)\n"\r
+ "{return args.sizeof-1;}\n")\r
+ STRING(REGEX MATCH "dmd" DMDTEST "${CMAKE_D_COMPILER}")\r
+ IF(DMDTEST STREQUAL "dmd")\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ ELSE(DMDTEST STREQUAL "dmd")\r
+ TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ENDIF(DMDTEST STREQUAL "dmd")\r
+ SET(C_TEST_WAS_RUN 1)\r
+ENDIF(NOT CMAKE_D_COMPILER_WORKS)\r
+\r
+IF(NOT CMAKE_D_COMPILER_WORKS)\r
+ MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- broken")\r
+ message(STATUS "To force a specific D compiler set the DC environment variable")\r
+ message(STATUS " ie - export DC=\"/opt/dmd/bin/dmd\"")\r
+ message(STATUS "If the D path is not set please use the D_PATH variable")\r
+ message(STATUS " ie - export D_PATH=\"/opt/dmd\"")\r
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log\r
+ "Determining if the D compiler works failed with "\r
+ "the following output:\n${OUTPUT}\n\n")\r
+ MESSAGE(FATAL_ERROR "The D compiler \"${CMAKE_D_COMPILER}\" "\r
+ "is not able to compile a simple test program.\nIt fails "\r
+ "with the following output:\n ${OUTPUT}\n\n"\r
+ "CMake will not be able to correctly generate this project.")\r
+ELSE(NOT CMAKE_D_COMPILER_WORKS)\r
+ IF(C_TEST_WAS_RUN)\r
+ MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- works")\r
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log\r
+ "Determining if the D compiler works passed with "\r
+ "the following output:\n${OUTPUT}\n\n") \r
+ ENDIF(C_TEST_WAS_RUN)\r
+ SET(CMAKE_D_COMPILER_WORKS 1 CACHE INTERNAL "")\r
+ # re-configure this file CMakeDCompiler.cmake so that it gets\r
+ # the value for CMAKE_SIZEOF_VOID_P\r
+ # configure variables set in this file for fast reload later on\r
+ IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)\r
+ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in \r
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)\r
+ ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)\r
+ CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in \r
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)\r
+ ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)\r
+ENDIF(NOT CMAKE_D_COMPILER_WORKS)\r
+\r
+IF(NOT CMAKE_D_PHOBOS_WORKS)\r
+ MESSAGE(STATUS "Check for working Phobos")\r
+ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ "import std.stdio;\n"\r
+ "int main(char[][] args)\n"\r
+ "{ writefln(\"%s\", args[0]); return args.sizeof-1;}\n")\r
+ IF(CMAKE_COMPILER_IS_GDC)\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ #CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos"\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos"\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ ELSE(CMAKE_COMPILER_IS_GDC)\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"\r
+ COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ ENDIF(CMAKE_COMPILER_IS_GDC)\r
+ SET(C_TEST_WAS_RUN 1)\r
+ENDIF(NOT CMAKE_D_PHOBOS_WORKS)\r
+\r
+IF(NOT CMAKE_D_PHOBOS_WORKS)\r
+ MESSAGE(STATUS "Check for working Phobos -- unavailable")\r
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log\r
+ "Determining if Phobos works failed with "\r
+ "the following output:\n${OUTPUT}\n\n")\r
+ #MESSAGE(FATAL_ERROR "Phobos does not work")\r
+ELSE(NOT CMAKE_D_PHOBOS_WORKS)\r
+ IF(C_TEST_WAS_RUN)\r
+ MESSAGE(STATUS "Check for working Phobos -- works")\r
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log\r
+ "Determining if Phobos works passed with "\r
+ "the following output:\n${OUTPUT}\n\n") \r
+ ENDIF(C_TEST_WAS_RUN)\r
+ SET(CMAKE_D_PHOBOS_WORKS 1 CACHE INTERNAL "")\r
+ENDIF(NOT CMAKE_D_PHOBOS_WORKS)\r
+\r
+IF(NOT CMAKE_D_TANGO_WORKS)\r
+ MESSAGE(STATUS "Check for working Tango")\r
+ FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ "import tango.io.Stdout;"\r
+ "int main(char[][] args)\n"\r
+ "{Stdout.newline();return args.sizeof-1;}\n")\r
+ IF(CMAKE_COMPILER_IS_GDC)\r
+ TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ CMAKE_FLAGS "-DLINK_LIBRARIES=gtango"\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ELSE(CMAKE_COMPILER_IS_GDC)\r
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d\r
+ CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libtango.a;${D_PATH}/lib/libphobos.a"\r
+ COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"\r
+ OUTPUT_VARIABLE OUTPUT) \r
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")\r
+ ENDIF(CMAKE_COMPILER_IS_GDC)\r
+ SET(C_TEST_WAS_RUN 1)\r
+ENDIF(NOT CMAKE_D_TANGO_WORKS)\r
+\r
+IF(NOT CMAKE_D_TANGO_WORKS)\r
+ MESSAGE(STATUS "Check for working Tango -- unavailable")\r
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log\r
+ "Determining if Tango works failed with "\r
+ "the following output:\n${OUTPUT}\n\n")\r
+ #MESSAGE(FATAL_ERROR "Tango does not work: \n${OUTPUT}\n\n")\r
+ELSE(NOT CMAKE_D_TANGO_WORKS)\r
+ IF(C_TEST_WAS_RUN)\r
+ MESSAGE(STATUS "Check for working Tango -- works")\r
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log\r
+ "Determining if Tango works passed with "\r
+ "the following output:\n${OUTPUT}\n\n") \r
+ ENDIF(C_TEST_WAS_RUN)\r
+ SET(CMAKE_D_TANGO_WORKS 1 CACHE INTERNAL "")\r
+ENDIF(NOT CMAKE_D_TANGO_WORKS)\r
+
+# if both tango and phobos are selected try to choose which one is available
+IF(CMAKE_D_USE_TANGO AND CMAKE_D_USE_PHOBOS)
+ MESSAGE(FATAL_ERROR "Tango AND Phobos selected, please choose one or the other!")
+ENDIF(CMAKE_D_USE_TANGO AND CMAKE_D_USE_PHOBOS)
+
+# ensure the user has the appropriate std lib available
+IF(CMAKE_D_USE_TANGO AND NOT CMAKE_D_TANGO_WORKS)
+ MESSAGE(FATAL_ERROR "Tango is required for this project, but it is not available!")
+ENDIF(CMAKE_D_USE_TANGO AND NOT CMAKE_D_TANGO_WORKS)
+
+IF(CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_PHOBOS_WORKS)
+ MESSAGE(FATAL_ERROR "Phobos is required for this project, but it is not available!")
+ENDIF(CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_PHOBOS_WORKS)
+
--- /dev/null
+CMakeD - CMake module for D Language
+
+Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
+ Tim Burrell <tim.burrell@gmail.com>
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null
+#
+# CMakeD - CMake module for D Language
+#
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
+# Tim Burrell <tim.burrell@gmail.com>
+#
+# All rights reserved.
+#
+# See Copyright.txt for details.
+#
+
+
+# - Find GDC Include Path
+#
+# GDC_INCLUDE_PATH = path to where object.d is found
+#
+
+SET(GDC_POSSIBLE_INCLUDE_PATHS
+ /usr/include/d/4.2.1
+ /usr/include/d/4.2.0
+ /usr/include/d/4.1.2
+ /usr/include/d/4.1.1
+ /usr/include/d/4.1.0
+ /usr/include/d/4.0.4
+ /usr/include/d/4.0.3
+ /usr/include/d/4.0.2
+ /usr/include/d/4.0.1
+ /usr/include/d/4.0.0
+ /usr/include/d/4.0.6
+ /usr/include/d/4.0.5
+ /usr/include/d/3.4.4
+ /usr/include/d/3.4.3
+ /usr/include/d/3.4.2
+ /usr/include/d/3.4.1
+ /usr/include/d/3.4.0
+ )
+
+FIND_PATH(GDC_INCLUDE_PATH object.d
+ ${GDC_POSSIBLE_INCLUDE_PATHS})
+
+MARK_AS_ADVANCED(
+ GDC_INCLUDE_PATH
+ )
--- /dev/null
+#
+# CMakeD - CMake module for D Language
+#
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
+# Tim Burrell <tim.burrell@gmail.com>
+#
+# All rights reserved.
+#
+# See Copyright.txt for details.
+#
+# Modified from CMake 2.6.5 gcc.cmake
+# See http://www.cmake.org/HTML/Copyright.html for details
+#
+
+IF(CMAKE_D_USE_TANGO)
+ SET(DSTDLIB_FLAGS "-version=Tango")
+ENDIF(CMAKE_D_USE_TANGO)
+IF(CMAKE_D_USE_PHOBOS)
+ SET(DSTDLIB_FLAGS "-version=Phobos")
+ENDIF(CMAKE_D_USE_PHOBOS)
+IF(CMAKE_D_BUILD_DOCS)
+ SET(DDOC_FLAGS "-D -Dddocumentation")
+ #FOREACH(item ${CMAKE_D_DDOC_FILES})
+ # SET(DDOC_FLAGS "${DDOC_FLAGS} ${item}")
+ #ENDFOREACH(item)
+ENDIF(CMAKE_D_BUILD_DOCS)
+
+SET (CMAKE_D_FLAGS_INIT "-version=Posix ${DSTDLIB_FLAGS} -I$ENV{D_PATH}/include -I$ENV{D_PATH}/import")
+SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
+# SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
+SET (CMAKE_D_FLAGS_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}")
+SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O -g ${DDOC_FLAGS}")
+# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+# SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")
--- /dev/null
+#
+# CMakeD - CMake module for D Language
+#
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
+# Tim Burrell <tim.burrell@gmail.com>
+#
+# All rights reserved.
+#
+# See Copyright.txt for details.
+#
+# Modified from CMake 2.6.5 gcc.cmake
+# See http://www.cmake.org/HTML/Copyright.html for details
+#
+
+IF(CMAKE_D_USE_TANGO)
+ SET(DSTDLIB_FLAGS "-fversion=Tango")
+ENDIF(CMAKE_D_USE_TANGO)
+IF(CMAKE_D_USE_PHOBOS)
+ SET(DSTDLIB_FLAGS "-fversion=Phobos")
+ENDIF(CMAKE_D_USE_PHOBOS)
+IF(CMAKE_D_BUILD_DOCS)
+ SET(DDOC_FLAGS "-fdoc -fdoc-dir=documentation")
+ FOREACH(item ${CMAKE_D_DDOC_FILES})
+ SET(DDOC_FLAGS "${DDOC_FLAGS} -fdoc-inc=${item}")
+ ENDFOREACH(item)
+ENDIF(CMAKE_D_BUILD_DOCS)
+
+SET (CMAKE_D_FLAGS_INIT "-fversion=Posix ${DSTDLIB_FLAGS}")
+SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
+SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
+SET (CMAKE_D_FLAGS_RELEASE_INIT "-O3 -fomit-frame-pointer -fweb -frelease -finline-functions ${DDOC_FLAGS}")
+SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O2 -g ${DDOC_FLAGS}")
+# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+#SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")
+
--- /dev/null
+#\r
+# CMakeD - CMake module for D Language\r
+#\r
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>\r
+# Tim Burrell <tim.burrell@gmail.com>\r
+#\r
+# All rights reserved.\r
+#\r
+# See Copyright.txt for details.\r
+#\r
+# Modified from CMake 2.6.5 gcc.cmake\r
+# See http://www.cmake.org/HTML/Copyright.html for details\r
+#\r
+\r
+IF(CMAKE_D_USE_TANGO)\r
+ SET(DSTDLIB_FLAGS "-version=Tango")\r
+ENDIF(CMAKE_D_USE_TANGO)\r
+IF(CMAKE_D_USE_PHOBOS)\r
+ SET(DSTDLIB_FLAGS "-version=Phobos")\r
+ENDIF(CMAKE_D_USE_PHOBOS)\r
+IF(CMAKE_D_BUILD_DOCS)\r
+ SET(DDOC_FLAGS "-D -Dddocumentation")\r
+ #FOREACH(item ${CMAKE_D_DDOC_FILES})\r
+ # SET(DDOC_FLAGS "${DDOC_FLAGS} ${item}")\r
+ #ENDFOREACH(item)\r
+ENDIF(CMAKE_D_BUILD_DOCS)\r
+\r
+SET (CMAKE_D_FLAGS_INIT "-version=Win ${DSTDLIB_FLAGS}")\r
+SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")\r
+# SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")\r
+SET (CMAKE_D_FLAGS_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}")\r
+SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O -g ${DDOC_FLAGS}")\r
+# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")\r
+SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")\r
+# SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")\r
+\r
--- /dev/null
+#\r
+# CMakeD - CMake module for D Language\r
+#\r
+# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>\r
+# Tim Burrell <tim.burrell@gmail.com>\r
+#\r
+# All rights reserved.\r
+#\r
+# See Copyright.txt for details.\r
+#\r
+# Modified from CMake 2.6.5 gcc.cmake\r
+# See http://www.cmake.org/HTML/Copyright.html for details\r
+#\r
+\r
+IF(CMAKE_D_USE_TANGO)\r
+ SET(DSTDLIB_FLAGS "-fversion=Tango")\r
+ENDIF(CMAKE_D_USE_TANGO)\r
+IF(CMAKE_D_USE_PHOBOS)\r
+ SET(DSTDLIB_FLAGS "-fversion=Phobos")\r
+ENDIF(CMAKE_D_USE_PHOBOS)\r
+IF(CMAKE_D_BUILD_DOCS)\r
+ SET(DDOC_FLAGS "-fdoc -fdoc-dir=documentation")\r
+ FOREACH(item ${CMAKE_D_DDOC_FILES})\r
+ SET(DDOC_FLAGS "${DDOC_FLAGS} -fdoc-inc=${item}")\r
+ ENDFOREACH(item)\r
+ENDIF(CMAKE_D_BUILD_DOCS)\r
+\r
+SET (CMAKE_D_FLAGS_INIT "-fversion=Win ${DSTDLIB_FLAGS}")\r
+SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")\r
+SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")\r
+SET (CMAKE_D_FLAGS_RELEASE_INIT "-O3 -fomit-frame-pointer -fweb -frelease -finline-functions ${DDOC_FLAGS}")\r
+SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O2 -g ${DDOC_FLAGS}")\r
+# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")\r
+SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")\r
+#SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")\r
+\r
--- /dev/null
+# check if the user wants to build ddocs
+#
+# Copyright (c) 2007 Tim Burrell <tim.burrell@gmail.com>
+#
+# All rights reserved.
+#
+# See Copyright.txt for details.
+#
+
+# Do not build documentation by default
+if (NOT CMAKE_D_BUILD_DOCS)
+ set(CMAKE_D_BUILD_DOCS False CACHE BOOLEAN TRUE FORCE)
+else (NOT CMAKE_D_BUILD_DOCS)
+ # check for specified ddoc files
+ # default to the candydoc usual
+ set(CMAKE_D_BUILD_DOCS True CACHE BOOLEAN FALSE FORCE)
+ if (NOT CMAKE_D_DDOC_FILES)
+ set(CMAKE_D_DDOC_FILES "documentation/candydoc/candy.ddoc;documentation/candydoc/modules.ddoc" CACHE STRING FALSE FORCE)
+ else (NOT CMAKE_D_DDOC_FILES)
+ set(CMAKE_D_DDOC_FILES "${CMAKE_D_DDOC_FILES}" CACHE STRING FALSE FORCE)
+ endif (NOT CMAKE_D_DDOC_FILES)
+
+ # copy the candydoc files
+ file(GLOB_RECURSE CANDY_DOC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/candydoc/*")
+ foreach(item ${CANDY_DOC_FILES})
+ string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" item ${item})
+ configure_file(${item} ${CMAKE_CURRENT_BINARY_DIR}/documentation/${item} COPYONLY)
+ endforeach(item)
+
+ # create modules.ddoc
+ file(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/*.d")
+ set(first True)
+ foreach(item ${sources})
+ # first make sure we're not config.d
+ string(REGEX MATCH "config\\.d" ignore ${item})
+ if (NOT ${ignore} MATCHES "")
+ # fix up the output
+ string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" item ${item})
+ string(REGEX REPLACE "\\.d" ".html" htmlFile ${item})
+ string(REGEX REPLACE "^.*/" "" htmlFile ${htmlFile})
+ string(REGEX REPLACE "\\.d" "" item ${item})
+ string(REGEX REPLACE "/" "." item ${item})
+ if (first)
+ set(modules "${item}")
+ set(first False)
+ set(CMAKE_D_DDOC_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/documentation/${htmlFile}" CACHE STRING FALSE FORCE)
+ else (first)
+ set(modules "${modules};${item}")
+ set(CMAKE_D_DDOC_CLEAN_FILES "${CMAKE_D_DDOC_CLEAN_FILES}" "${CMAKE_CURRENT_BINARY_DIR}/documentation/${htmlFile}" CACHE STRING FALSE FORCE)
+ endif (first)
+ endif (NOT ${ignore} MATCHES "")
+ endforeach(item)
+
+ # create formatted modules string
+ set(modString "MODULES = \n")
+ foreach(item ${modules})
+ set(modString "${modString}\t$(MODULE ${item})\n")
+ endforeach(item)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/documentation/candydoc/modules.ddoc" ${modString})
+endif (NOT CMAKE_D_BUILD_DOCS)
+
builddir=.build-$(hostname)-$(gcc -dumpmachine)-$(gcc -dumpversion)
rm -rf $builddir
mkdir -p $builddir
-ln -s $builddir build
+rm -f build && ln -s $builddir build
if test $# -eq 0; then
cd $builddir && cmake -DWITH_NNTP=1 -DWITH_IDN=1 -DUSE_HCACHE=1 -DCMAKE_INSTALL_PREFIX=/usr ..