|
|
@@ -175,14 +175,8 @@ else ()
|
|
|
if (WIN32)
|
|
|
# For Windows platform, give a second chance to search for a debug version of the library
|
|
|
find_library (URHO3D_LIBRARIES_DBG NAMES Urho3D_d ${URHO3D_LIB_SEARCH_HINT} PATH_SUFFIXES ${PATH_SUFFIX} ${SEARCH_OPT})
|
|
|
- # If both the non-debug and debug version of the libraries are found then use them both
|
|
|
set (URHO3D_LIBRARIES_REL ${URHO3D_LIBRARIES})
|
|
|
- # Otherwise, URHO3D_LIBRARIES variable should have the path to either one of the version
|
|
|
- if (URHO3D_LIBRARIES)
|
|
|
- if (URHO3D_LIBRARIES_DBG)
|
|
|
- list (APPEND URHO3D_LIBRARIES ${URHO3D_LIBRARIES_DBG})
|
|
|
- endif ()
|
|
|
- else ()
|
|
|
+ if (NOT URHO3D_LIBRARIES)
|
|
|
set (URHO3D_LIBRARIES ${URHO3D_LIBRARIES_DBG})
|
|
|
endif ()
|
|
|
endif ()
|
|
|
@@ -231,12 +225,20 @@ else ()
|
|
|
set (IOS_FLAGS -DCMAKE_MACOSX_BUNDLE=1 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=0)
|
|
|
elseif (ANDROID)
|
|
|
set (ANDROID_LIBRARIES "log\;android\;GLESv1_CM\;GLESv2")
|
|
|
- elseif (MSVC AND URHO3D_DLL)
|
|
|
- # This is a hack as it relies on internal implementation of try_run
|
|
|
- foreach (DLL ${URHO3D_DLL})
|
|
|
- get_filename_component (NAME ${DLL} NAME)
|
|
|
- execute_process (COMMAND ${CMAKE_COMMAND} -E copy ${DLL} ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/Debug/${NAME})
|
|
|
- endforeach ()
|
|
|
+ elseif (WIN32)
|
|
|
+ set (CMAKE_TRY_COMPILE_CONFIGURATION_SAVED ${CMAKE_TRY_COMPILE_CONFIGURATION})
|
|
|
+ if (URHO3D_LIBRARIES_REL)
|
|
|
+ set (CMAKE_TRY_COMPILE_CONFIGURATION Release)
|
|
|
+ else ()
|
|
|
+ set (CMAKE_TRY_COMPILE_CONFIGURATION Debug)
|
|
|
+ endif ()
|
|
|
+ if (MSVC AND URHO3D_DLL)
|
|
|
+ # This is a hack as it relies on internal implementation of try_run
|
|
|
+ foreach (DLL ${URHO3D_DLL})
|
|
|
+ get_filename_component (NAME ${DLL} NAME)
|
|
|
+ execute_process (COMMAND ${CMAKE_COMMAND} -E copy ${DLL} ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/${CMAKE_TRY_COMPILE_CONFIGURATION}/${NAME})
|
|
|
+ endforeach ()
|
|
|
+ endif ()
|
|
|
endif ()
|
|
|
# Since in cross-compiling mode we cannot run the test target executable and auto-discover the build options used by the found library,
|
|
|
# the next best thing is to evaluate the found export header indirectly (assuming the found library was built using the same export header)
|
|
|
@@ -268,13 +270,13 @@ else ()
|
|
|
unset (URHO3D_LIB_TYPE)
|
|
|
endif ()
|
|
|
unset (URHO3D_LIBRARIES CACHE)
|
|
|
- if (WIN32)
|
|
|
- unset (URHO3D_LIBRARIES_DBG CACHE)
|
|
|
- endif ()
|
|
|
- unset (URHO3D_DLL)
|
|
|
endif ()
|
|
|
endif ()
|
|
|
endforeach ()
|
|
|
+ # If both the non-debug and debug version of the libraries are found on Windows platform then use them both
|
|
|
+ if (URHO3D_LIBRARIES_REL AND URHO3D_LIBRARIES_DBG)
|
|
|
+ set (URHO3D_LIBRARIES ${URHO3D_LIBRARIES_REL} ${URHO3D_LIBRARIES_DBG})
|
|
|
+ endif ()
|
|
|
# Ensure auto-discovered variables always prefail over user settings in all the subsequent cmake rerun (even without redoing try_run)
|
|
|
foreach (VAR ${AUTO_DISCOVER_VARS})
|
|
|
if (DEFINED ${VAR} AND DEFINED AUTO_DISCOVERED_${VAR}) # Cannot combine these two ifs due to variable expansion error when it is not defined
|
|
|
@@ -292,6 +294,9 @@ else ()
|
|
|
if (CMAKE_SYSTEM_PREFIX_PATH_SAVED)
|
|
|
set (CMAKE_SYSTEM_PREFIX_PATH ${CMAKE_SYSTEM_PREFIX_PATH_SAVED})
|
|
|
endif ()
|
|
|
+ if (CMAKE_TRY_COMPILE_CONFIGURATION_SAVED)
|
|
|
+ set (CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_TRY_COMPILE_CONFIGURATION_SAVED})
|
|
|
+ endif ()
|
|
|
endif ()
|
|
|
|
|
|
if (URHO3D_INCLUDE_DIRS AND URHO3D_LIBRARIES AND URHO3D_LIB_TYPE AND URHO3D_COMPILE_RESULT)
|