Using more compiler flags in CMakeDInformation.cmake (similiar to CMakeCXXInformation.cmake).
This commit is contained in:
parent
e04241ecc3
commit
f41bd34fa2
1 changed files with 84 additions and 14 deletions
|
@ -4,7 +4,8 @@
|
||||||
# Copyright (c) 2013, Selman Ulug <selman.ulug@gmail.com>
|
# Copyright (c) 2013, Selman Ulug <selman.ulug@gmail.com>
|
||||||
# Tim Burrell <tim.burrell@gmail.com>
|
# Tim Burrell <tim.burrell@gmail.com>
|
||||||
# Steve King <sk@metrokings.com>
|
# Steve King <sk@metrokings.com>
|
||||||
# Dragos Carp <dragos.carp@gmail.com>
|
# Dragos Carp <dragos.carp@gmail.com>
|
||||||
|
# Konstantin Oblaukhov <oblaukhov.konstantin@gmail.com>
|
||||||
#
|
#
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
|
@ -84,6 +85,77 @@ 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)
|
||||||
|
|
||||||
|
# Lines below was taken from CMakeCXXInformation.cmake
|
||||||
|
# Not all of this flags are available on D compilers for now, but some as OPTIONS_PIC are.
|
||||||
|
|
||||||
|
if(NOT CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_D_COMPILE_OPTIONS_PIC)
|
||||||
|
set(CMAKE_DCOMPILE_OPTIONS_PIC ${CMAKE_D_COMPILE_OPTIONS_PIC})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_D_COMPILE_OPTIONS_PIE)
|
||||||
|
set(CMAKE_D_COMPILE_OPTIONS_PIE ${CMAKE_D_COMPILE_OPTIONS_PIE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_D_COMPILE_OPTIONS_DLL)
|
||||||
|
set(CMAKE_D_COMPILE_OPTIONS_DLL ${CMAKE_D_COMPILE_OPTIONS_DLL})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_SHARED_LIBRARY_D_FLAGS)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_D_FLAGS ${CMAKE_SHARED_LIBRARY_D_FLAGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_D_FLAGS)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_LINK_D_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_D_FLAGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_EXE_EXPORTS_D_FLAG)
|
||||||
|
set(CMAKE_EXE_EXPORTS_D_FLAG ${CMAKE_EXE_EXPORTS_D_FLAG})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_D_FLAG)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_SONAME_D_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_D_FLAG})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG)
|
||||||
|
set(CMAKE_EXECUTABLE_RUNTIME_D_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG_SEP)
|
||||||
|
set(CMAKE_EXECUTABLE_RUNTIME_D_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_D_FLAG)
|
||||||
|
set(CMAKE_EXECUTABLE_RPATH_LINK_D_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_D_WITH_RUNTIME_PATH)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_LINK_D_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_D_WITH_RUNTIME_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_INCLUDE_FLAG_D)
|
||||||
|
set(CMAKE_INCLUDE_FLAG_D ${CMAKE_INCLUDE_FLAG_D})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_INCLUDE_FLAG_SEP_D)
|
||||||
|
set(CMAKE_INCLUDE_FLAG_SEP_D ${CMAKE_INCLUDE_FLAG_SEP_D})
|
||||||
|
endif()
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -92,6 +164,15 @@ if(NOT CMAKE_MODULE_EXISTS)
|
||||||
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)
|
||||||
|
|
||||||
|
# repeat for modules
|
||||||
|
if(NOT CMAKE_SHARED_MODULE_CREATE_D_FLAGS)
|
||||||
|
set(CMAKE_SHARED_MODULE_CREATE_D_FLAGS ${CMAKE_SHARED_MODULE_CREATE_D_FLAGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_SHARED_MODULE_D_FLAGS)
|
||||||
|
set(CMAKE_SHARED_MODULE_D_FLAGS ${CMAKE_SHARED_MODULE_D_FLAGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_D_FLAGS_INIT "$ENV{DFLAGS} ${CMAKE_D_FLAGS_INIT}")
|
set(CMAKE_D_FLAGS_INIT "$ENV{DFLAGS} ${CMAKE_D_FLAGS_INIT}")
|
||||||
# avoid just having a space as the initial value for the cache
|
# avoid just having a space as the initial value for the cache
|
||||||
if(CMAKE_D_FLAGS_INIT STREQUAL " ")
|
if(CMAKE_D_FLAGS_INIT STREQUAL " ")
|
||||||
|
@ -160,8 +241,9 @@ 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)
|
||||||
|
|
||||||
if(NOT CMAKE_D_CREATE_STATIC_LIBRARY AND CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS)
|
if(NOT CMAKE_D_CREATE_STATIC_LIBRARY AND CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS)
|
||||||
set(CMAKE_D_CREATE_STATIC_LIBRARY
|
set(CMAKE_D_CREATE_STATIC_LIBRARY
|
||||||
"<CMAKE_D_COMPILER> ${CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS} <OBJECTS> ${CMAKE_D_DASH_O}<TARGET>")
|
"<CMAKE_D_COMPILER> ${CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS} <OBJECTS> ${CMAKE_D_DASH_O}<TARGET>")
|
||||||
|
@ -184,18 +266,6 @@ if(NOT CMAKE_D_LINK_EXECUTABLE)
|
||||||
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <OBJECTS> ${CMAKE_D_DASH_O}<TARGET> <LINK_LIBRARIES> ${CMAKE_D_STDLIBS}")
|
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <OBJECTS> ${CMAKE_D_DASH_O}<TARGET> <LINK_LIBRARIES> ${CMAKE_D_STDLIBS}")
|
||||||
endif(NOT CMAKE_D_LINK_EXECUTABLE)
|
endif(NOT CMAKE_D_LINK_EXECUTABLE)
|
||||||
|
|
||||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG)
|
|
||||||
set(CMAKE_EXECUTABLE_RUNTIME_D_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG})
|
|
||||||
endif(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG)
|
|
||||||
|
|
||||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG_SEP)
|
|
||||||
set(CMAKE_EXECUTABLE_RUNTIME_D_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP})
|
|
||||||
endif(NOT CMAKE_EXECUTABLE_RUNTIME_D_FLAG_SEP)
|
|
||||||
|
|
||||||
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_D_FLAG)
|
|
||||||
set(CMAKE_EXECUTABLE_RPATH_LINK_D_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG})
|
|
||||||
endif(NOT CMAKE_EXECUTABLE_RPATH_LINK_D_FLAG)
|
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
CMAKE_D_FLAGS
|
CMAKE_D_FLAGS
|
||||||
CMAKE_D_FLAGS_DEBUG
|
CMAKE_D_FLAGS_DEBUG
|
||||||
|
|
Loading…
Reference in a new issue