More windows fixes

This commit is contained in:
flithm 2007-08-28 11:19:05 +00:00
parent a81ea73566
commit 30c8f9774d
4 changed files with 451 additions and 441 deletions

View file

@ -1,225 +1,225 @@
# #
# CMakeD - CMake module for D Language # CMakeD - CMake module for D Language
# #
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com> # Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com> # Tim Burrell <tim.burrell@gmail.com>
# #
# All rights reserved. # All rights reserved.
# #
# See Copyright.txt for details. # See Copyright.txt for details.
# #
# Modified from CMake 2.6.5 CMakeCInformation.cmake # Modified from CMake 2.6.5 CMakeCInformation.cmake
# See http://www.cmake.org/HTML/Copyright.html for details # See http://www.cmake.org/HTML/Copyright.html for details
# #
# This file sets the basic flags for the D language in CMake. # This file sets the basic flags for the D language in CMake.
# It also loads the available platform file for the system-compiler # It also loads the available platform file for the system-compiler
# if it exists. # if it exists.
GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_D_COMPILER} NAME_WE) GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_D_COMPILER} NAME_WE)
IF(CMAKE_COMPILER_IS_GDC) IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_BASE_NAME gdc) SET(CMAKE_BASE_NAME gdc)
ELSE(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_BASE_NAME dmd) SET(CMAKE_BASE_NAME dmd)
ENDIF(CMAKE_COMPILER_IS_GDC) ENDIF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_SYSTEM_AND_D_COMPILER_INFO_FILE SET(CMAKE_SYSTEM_AND_D_COMPILER_INFO_FILE
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
# This should be included before the _INIT variables are # This should be included before the _INIT variables are
# used to initialize the cache. Since the rule variables # used to initialize the cache. Since the rule variables
# have if blocks on them, users can still define them here. # have if blocks on them, users can still define them here.
# But, it should still be after the platform file so changes can # But, it should still be after the platform file so changes can
# be made to those values. # be made to those values.
IF(CMAKE_USER_MAKE_RULES_OVERRIDE) IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE}) INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE) ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
IF(CMAKE_USER_MAKE_RULES_OVERRIDE_D) IF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_D}) INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_D})
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_D) ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)
# for most systems a module is the same as a shared library # for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just # so unless the variable CMAKE_MODULE_EXISTS is set just
# copy the values from the LIBRARY variables # copy the values from the LIBRARY variables
IF(NOT CMAKE_MODULE_EXISTS) IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_D_FLAGS ${CMAKE_SHARED_LIBRARY_D_FLAGS}) SET(CMAKE_SHARED_MODULE_D_FLAGS ${CMAKE_SHARED_LIBRARY_D_FLAGS})
SET(CMAKE_SHARED_MODULE_CREATE_D_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS}) SET(CMAKE_SHARED_MODULE_CREATE_D_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS})
ENDIF(NOT CMAKE_MODULE_EXISTS) ENDIF(NOT CMAKE_MODULE_EXISTS)
SET (CMAKE_D_FLAGS "$ENV{CFLAGS} ${CMAKE_D_FLAGS_INIT}" CACHE STRING SET (CMAKE_D_FLAGS "$ENV{CFLAGS} ${CMAKE_D_FLAGS_INIT}" CACHE STRING
"Flags for D compiler.") "Flags for D compiler.")
IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none # default build type is none
IF(NOT CMAKE_NO_BUILD_TYPE) IF(NOT CMAKE_NO_BUILD_TYPE)
SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
"Choose the type of build, options are: None(CMAKE_D_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") "Choose the type of build, options are: None(CMAKE_D_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ENDIF(NOT CMAKE_NO_BUILD_TYPE) ENDIF(NOT CMAKE_NO_BUILD_TYPE)
SET (CMAKE_D_FLAGS_DEBUG "${CMAKE_D_FLAGS_DEBUG_INIT}" CACHE STRING SET (CMAKE_D_FLAGS_DEBUG "${CMAKE_D_FLAGS_DEBUG_INIT}" CACHE STRING
"Flags used by the compiler during debug builds.") "Flags used by the compiler during debug builds.")
SET (CMAKE_D_FLAGS_MINSIZEREL "${CMAKE_D_FLAGS_MINSIZEREL_INIT}" CACHE STRING SET (CMAKE_D_FLAGS_MINSIZEREL "${CMAKE_D_FLAGS_MINSIZEREL_INIT}" CACHE STRING
"Flags used by the compiler during release minsize builds.") "Flags used by the compiler during release minsize builds.")
SET (CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE_INIT}" CACHE STRING SET (CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE_INIT}" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_D_FLAGS_RELWITHDEBINFO "${CMAKE_D_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING SET (CMAKE_D_FLAGS_RELWITHDEBINFO "${CMAKE_D_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.") "Flags used by the compiler during Release with Debug Info builds.")
ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
IF(CMAKE_D_STANDARD_LIBRARIES_INIT) IF(CMAKE_D_STANDARD_LIBRARIES_INIT)
SET(CMAKE_D_STANDARD_LIBRARIES "${CMAKE_D_STANDARD_LIBRARIES_INIT}" SET(CMAKE_D_STANDARD_LIBRARIES "${CMAKE_D_STANDARD_LIBRARIES_INIT}"
CACHE STRING "Libraries linked by defalut with all D applications.") CACHE STRING "Libraries linked by defalut with all D applications.")
MARK_AS_ADVANCED(CMAKE_D_STANDARD_LIBRARIES) MARK_AS_ADVANCED(CMAKE_D_STANDARD_LIBRARIES)
ENDIF(CMAKE_D_STANDARD_LIBRARIES_INIT) ENDIF(CMAKE_D_STANDARD_LIBRARIES_INIT)
INCLUDE(CMakeCommonLanguageInclude) INCLUDE(CMakeCommonLanguageInclude)
# now define the following rule variables # now define the following rule variables
# CMAKE_D_CREATE_SHARED_LIBRARY # CMAKE_D_CREATE_SHARED_LIBRARY
# CMAKE_D_CREATE_SHARED_MODULE # CMAKE_D_CREATE_SHARED_MODULE
# CMAKE_D_CREATE_STATIC_LIBRARY # CMAKE_D_CREATE_STATIC_LIBRARY
# CMAKE_D_COMPILE_OBJECT # CMAKE_D_COMPILE_OBJECT
# CMAKE_D_LINK_EXECUTABLE # CMAKE_D_LINK_EXECUTABLE
# variables supplied by the generator at use time # variables supplied by the generator at use time
# <TARGET> # <TARGET>
# <TARGET_BASE> the target without the suffix # <TARGET_BASE> the target without the suffix
# <OBJECTS> # <OBJECTS>
# <OBJECT> # <OBJECT>
# <LINK_LIBRARIES> # <LINK_LIBRARIES>
# <FLAGS> # <FLAGS>
# <LINK_FLAGS> # <LINK_FLAGS>
# D compiler information # D compiler information
# <CMAKE_D_COMPILER> # <CMAKE_D_COMPILER>
# <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> # <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS>
# <CMAKE_SHARED_MODULE_CREATE_D_FLAGS> # <CMAKE_SHARED_MODULE_CREATE_D_FLAGS>
# <CMAKE_D_LINK_FLAGS> # <CMAKE_D_LINK_FLAGS>
# Static library tools # Static library tools
# <CMAKE_AR> # <CMAKE_AR>
# <CMAKE_RANLIB> # <CMAKE_RANLIB>
IF("$ENV{D_PATH}" STREQUAL "") IF("$ENV{D_PATH}" STREQUAL "")
STRING(LENGTH ${CMAKE_D_COMPILER} CMAKE_D_COMPILER_LENGTH) STRING(LENGTH ${CMAKE_D_COMPILER} CMAKE_D_COMPILER_LENGTH)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 12") MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 12")
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 8") MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 8")
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
STRING(SUBSTRING ${CMAKE_D_COMPILER} 0 ${CMAKE_D_COMPILER_LENGTH} D_PATH) STRING(SUBSTRING ${CMAKE_D_COMPILER} 0 ${CMAKE_D_COMPILER_LENGTH} D_PATH)
ELSE("$ENV{D_PATH}" STREQUAL "") ELSE("$ENV{D_PATH}" STREQUAL "")
SET(D_PATH "$ENV{D_PATH}") SET(D_PATH "$ENV{D_PATH}")
ENDIF("$ENV{D_PATH}" STREQUAL "") ENDIF("$ENV{D_PATH}" STREQUAL "")
MESSAGE(STATUS "D Compiler Install Prefix (use D_PATH env var to override): ${D_PATH}") MESSAGE(STATUS "D Compiler Install Prefix (use D_PATH env var to override): ${D_PATH}")
IF(CMAKE_COMPILER_IS_GDC) IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_OUTPUT_D_FLAG "-o ") SET(CMAKE_OUTPUT_D_FLAG "-o ")
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared") SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
SET(CMAKE_LIBRARY_PATH_FLAG "-L") SET(CMAKE_LIBRARY_PATH_FLAG "-L")
SET(CMAKE_LINK_LIBRARY_FLAG "-l") SET(CMAKE_LINK_LIBRARY_FLAG "-l")
SET(CMAKE_D_VERSION_FLAG "-fversion=") SET(CMAKE_D_VERSION_FLAG "-fversion=")
ELSE(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_OUTPUT_D_FLAG "-of") SET(CMAKE_OUTPUT_D_FLAG "-of")
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") SET(CMAKE_D_VERSION_FLAG "-version=")
SET(CMAKE_LINK_LIBRARY_FLAG "-L+") IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(CMAKE_LIBRARY_PATH_FLAG "-I") SET(CMAKE_LINK_LIBRARY_FLAG "-L+")
FIND_PROGRAM(DMD_LIBRARIAN "lib.exe") SET(CMAKE_LIBRARY_PATH_FLAG "-I")
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") FIND_PROGRAM(DMD_LIBRARIAN "lib.exe")
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC") ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared") SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
SET(CMAKE_LIBRARY_PATH_FLAG "-L") SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
SET(CMAKE_LINK_LIBRARY_FLAG "-l") SET(CMAKE_LIBRARY_PATH_FLAG "-L")
SET(CMAKE_D_VERSION_FLAG "-version=") SET(CMAKE_LINK_LIBRARY_FLAG "-l")
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ENDIF(CMAKE_COMPILER_IS_GDC) ENDIF(CMAKE_COMPILER_IS_GDC)
IF(CMAKE_D_USE_TANGO) IF(CMAKE_D_USE_TANGO)
IF(CMAKE_COMPILER_IS_GDC) IF(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-fversion=Tango") SET(DSTDLIB_TYPE "-fversion=Tango")
SET(DSTDLIB_FLAGS "-lgtango") SET(DSTDLIB_FLAGS "-lgtango")
ELSE(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-version=Tango") SET(DSTDLIB_TYPE "-version=Tango")
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos") SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos")
ENDIF(CMAKE_COMPILER_IS_GDC) ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(CMAKE_D_USE_TANGO) ENDIF(CMAKE_D_USE_TANGO)
IF(CMAKE_D_USE_PHOBOS) IF(CMAKE_D_USE_PHOBOS)
IF(CMAKE_COMPILER_IS_GDC) IF(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-fversion=Phobos") SET(DSTDLIB_TYPE "-fversion=Phobos")
SET(DSTDLIB_FLAGS "-lphobos -version=Phobos") SET(DSTDLIB_FLAGS "-lphobos -version=Phobos")
ELSE(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-version=Phobos") SET(DSTDLIB_TYPE "-version=Phobos")
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos") SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos")
ENDIF(CMAKE_COMPILER_IS_GDC) ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(CMAKE_D_USE_PHOBOS) ENDIF(CMAKE_D_USE_PHOBOS)
# create a D shared library # create a D shared library
IF(NOT CMAKE_D_CREATE_SHARED_LIBRARY) IF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
IF(CMAKE_COMPILER_IS_GDC) IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_D_CREATE_SHARED_LIBRARY SET(CMAKE_D_CREATE_SHARED_LIBRARY
"<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>") "<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>")
ELSE(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_D_CREATE_SHARED_LIBRARY SET(CMAKE_D_CREATE_SHARED_LIBRARY
"<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}") "<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}")
ENDIF(CMAKE_COMPILER_IS_GDC) ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(NOT CMAKE_D_CREATE_SHARED_LIBRARY) ENDIF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
# create a D shared module just copy the shared library rule # create a D shared module just copy the shared library rule
IF(NOT CMAKE_D_CREATE_SHARED_MODULE) IF(NOT CMAKE_D_CREATE_SHARED_MODULE)
SET(CMAKE_D_CREATE_SHARED_MODULE ${CMAKE_D_CREATE_SHARED_LIBRARY}) SET(CMAKE_D_CREATE_SHARED_MODULE ${CMAKE_D_CREATE_SHARED_LIBRARY})
ENDIF(NOT CMAKE_D_CREATE_SHARED_MODULE) ENDIF(NOT CMAKE_D_CREATE_SHARED_MODULE)
# create a D static library # create a D static library
IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY) IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
IF(CMAKE_COMPILER_IS_GDC) IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_D_CREATE_STATIC_LIBRARY SET(CMAKE_D_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> ") "<CMAKE_RANLIB> <TARGET> ")
ELSE(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET(CMAKE_D_CREATE_STATIC_LIBRARY SET(CMAKE_D_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>" "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>"
"<CMAKE_RANLIB> <TARGET>") "<CMAKE_RANLIB> <TARGET>")
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET(CMAKE_D_CREATE_STATIC_LIBRARY SET(CMAKE_D_CREATE_STATIC_LIBRARY
"${DMD_LIBRARIAN} -c -p256 <TARGET> <OBJECTS>") "${DMD_LIBRARIAN} -c -p256 <TARGET> <OBJECTS>")
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
ENDIF(CMAKE_COMPILER_IS_GDC) ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY) ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
# compile a D file into an object file # compile a D file into an object file
IF(NOT CMAKE_D_COMPILE_OBJECT) IF(NOT CMAKE_D_COMPILE_OBJECT)
SET(CMAKE_D_COMPILE_OBJECT SET(CMAKE_D_COMPILE_OBJECT
"<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_OUTPUT_D_FLAG}<OBJECT> -c <SOURCE>") "<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_OUTPUT_D_FLAG}<OBJECT> -c <SOURCE>")
ENDIF(NOT CMAKE_D_COMPILE_OBJECT) ENDIF(NOT CMAKE_D_COMPILE_OBJECT)
IF(NOT CMAKE_D_LINK_EXECUTABLE) IF(NOT CMAKE_D_LINK_EXECUTABLE)
IF(CMAKE_COMPILER_IS_GDC) IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_D_LINK_EXECUTABLE SET(CMAKE_D_LINK_EXECUTABLE
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES> ${DSTDLIB_FLAGS} ${DSTDLIB_TYPE}") "<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES> ${DSTDLIB_FLAGS} ${DSTDLIB_TYPE}")
ELSE(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET(CMAKE_D_LINK_EXECUTABLE SET(CMAKE_D_LINK_EXECUTABLE
"gcc ${DLINK_FLAGS} <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -lpthread -lm ${DSTDLIB_FLAGS}") "gcc ${DLINK_FLAGS} <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -lpthread -lm ${DSTDLIB_FLAGS}")
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET(CMAKE_D_LINK_EXECUTABLE SET(CMAKE_D_LINK_EXECUTABLE
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES>") "<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES>")
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
ENDIF(CMAKE_COMPILER_IS_GDC) ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(NOT CMAKE_D_LINK_EXECUTABLE) ENDIF(NOT CMAKE_D_LINK_EXECUTABLE)
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
CMAKE_D_FLAGS CMAKE_D_FLAGS
CMAKE_D_FLAGS_DEBUG CMAKE_D_FLAGS_DEBUG
CMAKE_D_FLAGS_MINSIZEREL CMAKE_D_FLAGS_MINSIZEREL
CMAKE_D_FLAGS_RELEASE CMAKE_D_FLAGS_RELEASE
CMAKE_D_FLAGS_RELWITHDEBINFO CMAKE_D_FLAGS_RELWITHDEBINFO
) )
SET(CMAKE_D_INFORMATION_LOADED 1) SET(CMAKE_D_INFORMATION_LOADED 1)

View file

@ -1,144 +1,154 @@
# #
# CMakeD - CMake module for D Language # CMakeD - CMake module for D Language
# #
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com> # Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com> # Tim Burrell <tim.burrell@gmail.com>
# #
# All rights reserved. # All rights reserved.
# #
# See Copyright.txt for details. # See Copyright.txt for details.
# #
# Modified from CMake 2.6.5 CMakeTestCCompiler.cmake # Modified from CMake 2.6.5 CMakeTestCCompiler.cmake
# See http://www.cmake.org/HTML/Copyright.html for details # See http://www.cmake.org/HTML/Copyright.html for details
# #
# This file is used by EnableLanguage in cmGlobalGenerator to # This file is used by EnableLanguage in cmGlobalGenerator to
# determine that that selected D compiler can actually compile # determine that that selected D compiler can actually compile
# and link the most basic of programs. If not, a fatal error # and link the most basic of programs. If not, a fatal error
# is set and cmake stops processing commands and will not generate # is set and cmake stops processing commands and will not generate
# any makefiles or projects. # any makefiles or projects.
IF(NOT CMAKE_D_COMPILER_WORKS) IF(NOT CMAKE_D_COMPILER_WORKS)
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER}") MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER}")
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
"int main(char[][] args)\n" "int main(char[][] args)\n"
"{return args.sizeof-1;}\n") "{return args.sizeof-1;}\n")
STRING(REGEX MATCH "dmd" DMDTEST "${CMAKE_D_COMPILER}") STRING(REGEX MATCH "dmd" DMDTEST "${CMAKE_D_COMPILER}")
IF(DMDTEST STREQUAL "dmd") IF(DMDTEST STREQUAL "dmd")
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a" CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ELSE(DMDTEST STREQUAL "dmd") ELSE(DMDTEST STREQUAL "dmd")
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
ENDIF(DMDTEST STREQUAL "dmd") ENDIF(DMDTEST STREQUAL "dmd")
SET(C_TEST_WAS_RUN 1) SET(C_TEST_WAS_RUN 1)
ENDIF(NOT CMAKE_D_COMPILER_WORKS) ENDIF(NOT CMAKE_D_COMPILER_WORKS)
IF(NOT CMAKE_D_COMPILER_WORKS) IF(NOT CMAKE_D_COMPILER_WORKS)
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- broken") MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- broken")
message(STATUS "To force a specific D compiler set the DC environment variable") message(STATUS "To force a specific D compiler set the DC environment variable")
message(STATUS " ie - export DC=\"/opt/dmd/bin/dmd\"") message(STATUS " ie - export DC=\"/opt/dmd/bin/dmd\"")
message(STATUS "If the D path is not set please use the D_PATH variable") message(STATUS "If the D path is not set please use the D_PATH variable")
message(STATUS " ie - export D_PATH=\"/opt/dmd\"") message(STATUS " ie - export D_PATH=\"/opt/dmd\"")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the D compiler works failed with " "Determining if the D compiler works failed with "
"the following output:\n${OUTPUT}\n\n") "the following output:\n${OUTPUT}\n\n")
MESSAGE(FATAL_ERROR "The D compiler \"${CMAKE_D_COMPILER}\" " MESSAGE(FATAL_ERROR "The D compiler \"${CMAKE_D_COMPILER}\" "
"is not able to compile a simple test program.\nIt fails " "is not able to compile a simple test program.\nIt fails "
"with the following output:\n ${OUTPUT}\n\n" "with the following output:\n ${OUTPUT}\n\n"
"CMake will not be able to correctly generate this project.") "CMake will not be able to correctly generate this project.")
ELSE(NOT CMAKE_D_COMPILER_WORKS) ELSE(NOT CMAKE_D_COMPILER_WORKS)
IF(C_TEST_WAS_RUN) IF(C_TEST_WAS_RUN)
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- works") MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- works")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the D compiler works passed with " "Determining if the D compiler works passed with "
"the following output:\n${OUTPUT}\n\n") "the following output:\n${OUTPUT}\n\n")
ENDIF(C_TEST_WAS_RUN) ENDIF(C_TEST_WAS_RUN)
SET(CMAKE_D_COMPILER_WORKS 1 CACHE INTERNAL "") SET(CMAKE_D_COMPILER_WORKS 1 CACHE INTERNAL "")
# re-configure this file CMakeDCompiler.cmake so that it gets # re-configure this file CMakeDCompiler.cmake so that it gets
# the value for CMAKE_SIZEOF_VOID_P # the value for CMAKE_SIZEOF_VOID_P
# configure variables set in this file for fast reload later on # configure variables set in this file for fast reload later on
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in) IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in) ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in) ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
ENDIF(NOT CMAKE_D_COMPILER_WORKS) ENDIF(NOT CMAKE_D_COMPILER_WORKS)
IF(NOT CMAKE_D_PHOBOS_WORKS) IF(NOT CMAKE_D_PHOBOS_WORKS)
MESSAGE(STATUS "Check for working Phobos") MESSAGE(STATUS "Check for working Phobos")
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
"import std.stdio;\n" "import std.stdio;\n"
"int main(char[][] args)\n" "int main(char[][] args)\n"
"{ writefln(\"%s\", args[0]); return args.sizeof-1;}\n") "{ writefln(\"%s\", args[0]); return args.sizeof-1;}\n")
IF(CMAKE_COMPILER_IS_GDC) IF(CMAKE_COMPILER_IS_GDC)
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos" CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos"
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
ELSE(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a" TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import" OUTPUT_VARIABLE OUTPUT)
OUTPUT_VARIABLE OUTPUT) ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ENDIF(CMAKE_COMPILER_IS_GDC) TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
SET(C_TEST_WAS_RUN 1) CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"
ENDIF(NOT CMAKE_D_PHOBOS_WORKS) COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"
OUTPUT_VARIABLE OUTPUT)
IF(NOT CMAKE_D_PHOBOS_WORKS) ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
MESSAGE(STATUS "Check for working Phobos -- unavailable") ENDIF(CMAKE_COMPILER_IS_GDC)
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log SET(C_TEST_WAS_RUN 1)
"Determining if Phobos works failed with " ENDIF(NOT CMAKE_D_PHOBOS_WORKS)
"the following output:\n${OUTPUT}\n\n")
#MESSAGE(FATAL_ERROR "Phobos does not work") IF(NOT CMAKE_D_PHOBOS_WORKS)
ELSE(NOT CMAKE_D_PHOBOS_WORKS) MESSAGE(STATUS "Check for working Phobos -- unavailable")
IF(C_TEST_WAS_RUN) FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
MESSAGE(STATUS "Check for working Phobos -- works") "Determining if Phobos works failed with "
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "the following output:\n${OUTPUT}\n\n")
"Determining if Phobos works passed with " #MESSAGE(FATAL_ERROR "Phobos does not work")
"the following output:\n${OUTPUT}\n\n") ELSE(NOT CMAKE_D_PHOBOS_WORKS)
ENDIF(C_TEST_WAS_RUN) IF(C_TEST_WAS_RUN)
SET(CMAKE_D_PHOBOS_WORKS 1 CACHE INTERNAL "") MESSAGE(STATUS "Check for working Phobos -- works")
ENDIF(NOT CMAKE_D_PHOBOS_WORKS) FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if Phobos works passed with "
IF(NOT CMAKE_D_TANGO_WORKS) "the following output:\n${OUTPUT}\n\n")
MESSAGE(STATUS "Check for working Tango") ENDIF(C_TEST_WAS_RUN)
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d SET(CMAKE_D_PHOBOS_WORKS 1 CACHE INTERNAL "")
"import tango.io.Stdout;" ENDIF(NOT CMAKE_D_PHOBOS_WORKS)
"int main(char[][] args)\n"
"{Stdout.newline();return args.sizeof-1;}\n") IF(NOT CMAKE_D_TANGO_WORKS)
IF(CMAKE_COMPILER_IS_GDC) MESSAGE(STATUS "Check for working Tango")
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
CMAKE_FLAGS "-DLINK_LIBRARIES=gtango" "import tango.io.Stdout;"
OUTPUT_VARIABLE OUTPUT) "int main(char[][] args)\n"
ELSE(CMAKE_COMPILER_IS_GDC) "{Stdout.newline();return args.sizeof-1;}\n")
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d IF(CMAKE_COMPILER_IS_GDC)
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libtango.a;${D_PATH}/lib/libphobos.a" TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import" CMAKE_FLAGS "-DLINK_LIBRARIES=gtango"
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
ENDIF(CMAKE_COMPILER_IS_GDC) ELSE(CMAKE_COMPILER_IS_GDC)
SET(C_TEST_WAS_RUN 1) IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ENDIF(NOT CMAKE_D_TANGO_WORKS) TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
OUTPUT_VARIABLE OUTPUT)
IF(NOT CMAKE_D_TANGO_WORKS) ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
MESSAGE(STATUS "Check for working Tango -- unavailable") TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libtango.a;${D_PATH}/lib/libphobos.a"
"Determining if Tango works failed with " COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"
"the following output:\n${OUTPUT}\n\n") OUTPUT_VARIABLE OUTPUT)
#MESSAGE(FATAL_ERROR "Tango does not work: \n${OUTPUT}\n\n") ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ELSE(NOT CMAKE_D_TANGO_WORKS) ENDIF(CMAKE_COMPILER_IS_GDC)
IF(C_TEST_WAS_RUN) SET(C_TEST_WAS_RUN 1)
MESSAGE(STATUS "Check for working Tango -- works") ENDIF(NOT CMAKE_D_TANGO_WORKS)
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if Tango works passed with " IF(NOT CMAKE_D_TANGO_WORKS)
"the following output:\n${OUTPUT}\n\n") MESSAGE(STATUS "Check for working Tango -- unavailable")
ENDIF(C_TEST_WAS_RUN) FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
SET(CMAKE_D_TANGO_WORKS 1 CACHE INTERNAL "") "Determining if Tango works failed with "
ENDIF(NOT CMAKE_D_TANGO_WORKS) "the following output:\n${OUTPUT}\n\n")
#MESSAGE(FATAL_ERROR "Tango does not work: \n${OUTPUT}\n\n")
ELSE(NOT CMAKE_D_TANGO_WORKS)
IF(C_TEST_WAS_RUN)
MESSAGE(STATUS "Check for working Tango -- works")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if Tango works passed with "
"the following output:\n${OUTPUT}\n\n")
ENDIF(C_TEST_WAS_RUN)
SET(CMAKE_D_TANGO_WORKS 1 CACHE INTERNAL "")
ENDIF(NOT CMAKE_D_TANGO_WORKS)

View file

@ -1,36 +1,36 @@
# #
# CMakeD - CMake module for D Language # CMakeD - CMake module for D Language
# #
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com> # Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com> # Tim Burrell <tim.burrell@gmail.com>
# #
# All rights reserved. # All rights reserved.
# #
# See Copyright.txt for details. # See Copyright.txt for details.
# #
# Modified from CMake 2.6.5 gcc.cmake # Modified from CMake 2.6.5 gcc.cmake
# See http://www.cmake.org/HTML/Copyright.html for details # See http://www.cmake.org/HTML/Copyright.html for details
# #
IF(CMAKE_D_USE_TANGO) IF(CMAKE_D_USE_TANGO)
SET(DSTDLIB_FLAGS "-version=Tango") SET(DSTDLIB_FLAGS "-version=Tango")
ENDIF(CMAKE_D_USE_TANGO) ENDIF(CMAKE_D_USE_TANGO)
IF(CMAKE_D_USE_PHOBOS) IF(CMAKE_D_USE_PHOBOS)
SET(DSTDLIB_FLAGS "-version=Phobos") SET(DSTDLIB_FLAGS "-version=Phobos")
ENDIF(CMAKE_D_USE_PHOBOS) ENDIF(CMAKE_D_USE_PHOBOS)
IF(CMAKE_D_BUILD_DOCS) IF(CMAKE_D_BUILD_DOCS)
SET(DDOC_FLAGS "-D -Dddocumentation") SET(DDOC_FLAGS "-D -Dddocumentation")
#FOREACH(item ${CMAKE_D_DDOC_FILES}) #FOREACH(item ${CMAKE_D_DDOC_FILES})
# SET(DDOC_FLAGS "${DDOC_FLAGS} ${item}") # SET(DDOC_FLAGS "${DDOC_FLAGS} ${item}")
#ENDFOREACH(item) #ENDFOREACH(item)
ENDIF(CMAKE_D_BUILD_DOCS) 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_INIT "-version=Win ${DSTDLIB_FLAGS}")
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}") SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
# SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${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_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O -g ${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_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_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
# SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ") # SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")

View file

@ -1,36 +1,36 @@
# #
# CMakeD - CMake module for D Language # CMakeD - CMake module for D Language
# #
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com> # Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com> # Tim Burrell <tim.burrell@gmail.com>
# #
# All rights reserved. # All rights reserved.
# #
# See Copyright.txt for details. # See Copyright.txt for details.
# #
# Modified from CMake 2.6.5 gcc.cmake # Modified from CMake 2.6.5 gcc.cmake
# See http://www.cmake.org/HTML/Copyright.html for details # See http://www.cmake.org/HTML/Copyright.html for details
# #
IF(CMAKE_D_USE_TANGO) IF(CMAKE_D_USE_TANGO)
SET(DSTDLIB_FLAGS "-fversion=Tango") SET(DSTDLIB_FLAGS "-fversion=Tango")
ENDIF(CMAKE_D_USE_TANGO) ENDIF(CMAKE_D_USE_TANGO)
IF(CMAKE_D_USE_PHOBOS) IF(CMAKE_D_USE_PHOBOS)
SET(DSTDLIB_FLAGS "-fversion=Phobos") SET(DSTDLIB_FLAGS "-fversion=Phobos")
ENDIF(CMAKE_D_USE_PHOBOS) ENDIF(CMAKE_D_USE_PHOBOS)
IF(CMAKE_D_BUILD_DOCS) IF(CMAKE_D_BUILD_DOCS)
SET(DDOC_FLAGS "-fdoc -fdoc-dir=documentation") SET(DDOC_FLAGS "-fdoc -fdoc-dir=documentation")
FOREACH(item ${CMAKE_D_DDOC_FILES}) FOREACH(item ${CMAKE_D_DDOC_FILES})
SET(DDOC_FLAGS "${DDOC_FLAGS} -fdoc-inc=${item}") SET(DDOC_FLAGS "${DDOC_FLAGS} -fdoc-inc=${item}")
ENDFOREACH(item) ENDFOREACH(item)
ENDIF(CMAKE_D_BUILD_DOCS) ENDIF(CMAKE_D_BUILD_DOCS)
SET (CMAKE_D_FLAGS_INIT "-fversion=Posix ${DSTDLIB_FLAGS}") SET (CMAKE_D_FLAGS_INIT "-fversion=Win ${DSTDLIB_FLAGS}")
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}") SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${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_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_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_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_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
#SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ") #SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")