mirror of https://github.com/axmolengine/axmol.git
71 lines
1.9 KiB
Plaintext
71 lines
1.9 KiB
Plaintext
macro(pre_build TARGET_NAME)
|
|
add_custom_target( ${TARGET_NAME}_PRE_BUILD ALL )
|
|
|
|
add_custom_command(
|
|
TARGET ${TARGET_NAME}_PRE_BUILD
|
|
${ARGN}
|
|
PRE_BUILD
|
|
COMMENT "${TARGET_NAME}_PRE_BUILD ..."
|
|
)
|
|
|
|
add_custom_target(${TARGET_NAME}_CORE_PRE_BUILD)
|
|
add_dependencies(${TARGET_NAME}_PRE_BUILD ${TARGET_NAME}_CORE_PRE_BUILD)
|
|
add_dependencies(${TARGET_NAME} ${TARGET_NAME}_PRE_BUILD)
|
|
endmacro()
|
|
|
|
#cmake has some strange defaults, this should help us a lot
|
|
#Please use them everywhere
|
|
|
|
#WINDOWS = Windows Desktop
|
|
#WINRT = Windows RT
|
|
#WP8 = Windows Phone 8
|
|
#ANDROID = ANDROID
|
|
#IOS = IOS
|
|
#MACOSX = MAC OSX
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
if(WINRT)
|
|
set(SYSTEM_STRING "Windows RT")
|
|
elseif(WP8)
|
|
set(SYSTEM_STRING "Windows Phone 8")
|
|
else()
|
|
set(WINDOWS TRUE)
|
|
set(SYSTEM_STRING "Windows Desktop")
|
|
endif()
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
if(ANDROID)
|
|
set(SYSTEM_STRING "Android")
|
|
else()
|
|
set(LINUX TRUE)
|
|
set(SYSTEM_STRING "Linux")
|
|
endif()
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
if(IOS)
|
|
set(SYSTEM_STRING "IOS")
|
|
else()
|
|
set(MACOSX TRUE)
|
|
set(SYSTEM_STRING "Mac OSX")
|
|
endif()
|
|
endif()
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
set(COMPILER_STRING ${CMAKE_CXX_COMPILER_ID})
|
|
set(CLANG TRUE)
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
if(MINGW)
|
|
set(COMPILER_STRING "Mingw GCC")
|
|
else()
|
|
set(COMPILER_STRING "GCC")
|
|
endif()
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|
set(COMPILER_STRING "${CMAKE_CXX_COMPILER_ID} C++")
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
set(COMPILER_STRING "Visual Studio C++")
|
|
endif()
|
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
set(BUILDING_STRING "It appears you are cross compiling for ${SYSTEM_STRING} with ${COMPILER_STRING}")
|
|
else()
|
|
set(BUILDING_STRING "It appears you are builing natively for ${SYSTEM_STRING} with ${COMPILER_STRING}")
|
|
endif()
|