소스 검색

Fix the STATIC and SHARED build for VS and Xcode.
Cleanup comments.

Yao Wei Tjong 姚伟忠 5 년 전
부모
커밋
3ba62f036e

+ 1 - 1
CMakeLists.txt

@@ -20,7 +20,7 @@
 # THE SOFTWARE.
 #
 
-# Set CMake minimum version and CMake policy required by UrhoCommon module
+# Set CMake minimum version
 cmake_minimum_required (VERSION 3.10.2)
 
 # Set project name

+ 1 - 1
Docs/GettingStarted.dox

@@ -602,7 +602,7 @@ The physical project root directory is also the logical project source tree in C
 In your own project root directory, create a main CMakeLists.txt file and add the following lines: (replace MyProjectName and MyExecutableName with the actual names you want)
 
 \code
-# Set CMake minimum version and CMake policy required by UrhoCommon module
+# Set CMake minimum version
 cmake_minimum_required (VERSION 3.10.2)
 
 # Set project name

+ 1 - 1
Rakefile

@@ -648,7 +648,7 @@ def scaffolding dir, project = 'Scaffolding', target = 'Main'
   end
   dir.gsub!(/\//, '\\') if ENV['OS']
   build_script = <<EOF
-# Set CMake minimum version and CMake policy required by UrhoCommon module
+# Set CMake minimum version
 cmake_minimum_required (VERSION 3.10.2)
 
 # Set project name

+ 1 - 1
Source/Clang-Tools/CMakeLists.txt

@@ -27,7 +27,7 @@ if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
     # All Clang-tools must be natively built and output to bin/tool/clang subdir to differentiate them from the rest
     set_output_directories (${CMAKE_BINARY_DIR}/bin/tool/clang RUNTIME PDB)
 else ()
-    # Set CMake minimum version and CMake policy required by UrhoCommon module
+    # Set CMake minimum version
     cmake_minimum_required (VERSION 3.10.2)
 
     # Set project name

+ 1 - 1
Source/ThirdParty/LuaJIT/CMakeLists.txt

@@ -24,7 +24,7 @@
 # The cross-compiling logic is ported to CMake as faithful as possible although currently Urho3D does not support all target archs supported by LuaJIT
 
 if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
-    # Set CMake minimum version and CMake policy required by UrhoCommon module
+    # Set CMake minimum version
     cmake_minimum_required (VERSION 3.10.2)
 
     # Set project name

+ 1 - 1
Source/ThirdParty/LuaJIT/src/host/CMakeLists.txt

@@ -21,7 +21,7 @@
 #
 
 if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
-    # Set CMake minimum version and CMake policy required by UrhoCommon module
+    # Set CMake minimum version
     cmake_minimum_required (VERSION 3.10.2)
 
     # Set project name

+ 1 - 1
Source/ThirdParty/toluapp/src/bin/CMakeLists.txt

@@ -21,7 +21,7 @@
 #
 
 if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
-    # Set CMake minimum version and CMake policy required by UrhoCommon module
+    # Set CMake minimum version
     cmake_minimum_required (VERSION 3.10.2)
 
     # Set project name

+ 1 - 1
Source/Tools/PackageTool/CMakeLists.txt

@@ -21,7 +21,7 @@
 #
 
 if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
-    # Set CMake minimum version and CMake policy required by UrhoCommon module
+    # Set CMake minimum version
     cmake_minimum_required (VERSION 3.10.2)
 
     # Set project name

+ 6 - 7
Source/Urho3D/CMakeLists.txt

@@ -370,20 +370,19 @@ endif ()
 
 # Setup dependency libraries to be linked or archived as a whole inside Urho3D library for SHARED or STATIC lib type, respectively
 if (APPLE)
-    set (WHOLE_ARCHIVE -force_load)
+    set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES -force_load)
 elseif (MSVC)
-    set (WHOLE_ARCHIVE /WHOLEARCHIVE)   # Require VS 2015 Update 2 onward
+    set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_OPTIONS /FORCE /WHOLEARCHIVE)  # Require VS 2015 Update 2 onward
 else ()
-    set (WHOLE_ARCHIVE -Wl,--whole-archive)
+    set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES -Wl,--whole-archive)
 endif ()
-set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES ${WHOLE_ARCHIVE})
 foreach (TARGET ${STATIC_LIBRARY_TARGETS})
     set (ARCHIVE $<TARGET_FILE:${TARGET}>)
-    if (NOT ${TARGET} MATCHES boost|rapidjson|STB)    # Exlucde header-only "fake" static lib targets
-        set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES ${ARCHIVE})    # Should work for all platforms while building shared library
+    if (NOT ${TARGET} MATCHES boost|rapidjson|STB)  # Exclude header-only "fake" static lib targets
+        set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES ${ARCHIVE})      # Should work for all compiler toolchains while building shared library
         if (URHO3D_LIB_TYPE STREQUAL STATIC)
             if (XCODE OR MSVC)  # Only works in Xcode and MSVC while building static library
-                set_property (TARGET ${TARGET_NAME} APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " \"${ARCHIVE}\"")
+                set_property (TARGET ${TARGET_NAME} APPEND STATIC_LIBRARY_OPTIONS ${ARCHIVE})
             else ()
                 list (APPEND ARCHIVES ${ARCHIVE})   # Accumulate the target locations for archiving later
             endif ()

+ 1 - 1
android/launcher-app/CMakeLists.txt

@@ -20,7 +20,7 @@
 # THE SOFTWARE.
 #
 
-# Set CMake minimum version and CMake policy required by UrhoCommon module
+# Set CMake minimum version
 cmake_minimum_required (VERSION 3.10.2)
 
 # Set project name