Browse Source

Clean up to remove unused CMake variables.
LIBS is now defunct. No more dual purpose usage.
INCLUDE_DIRS_ONLY is renamed to INCLUDE_DIRS.
LINK_LIBS_ONLY is renamed to LIBS.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
35307869ee

+ 16 - 17
CMake/Modules/Urho3D-CMake-common.cmake

@@ -582,11 +582,10 @@ endmacro ()
 # Macro for setting up dependency lib for compilation and linking of a target
 macro (setup_target)
     # Include directories
-    include_directories (${LIBS} ${INCLUDE_DIRS_ONLY})
+    include_directories (${INCLUDE_DIRS})
     # Link libraries
     define_dependency_libs (${TARGET_NAME})
-    string (REGEX REPLACE \\.\\./|ThirdParty/|Urho3D/|Extras/|/include|/src "" STRIP_LIBS "${LIBS};${LINK_LIBS_ONLY}")
-    target_link_libraries (${TARGET_NAME} ${ABSOLUTE_PATH_LIBS} ${STRIP_LIBS})
+    target_link_libraries (${TARGET_NAME} ${ABSOLUTE_PATH_LIBS} ${LIBS})
 
     # CMake does not support IPHONEOS_DEPLOYMENT_TARGET the same manner as it supports CMAKE_OSX_DEPLOYMENT_TARGET
     # The iOS deployment target is set using the corresponding Xcode attribute as target property instead
@@ -772,14 +771,14 @@ macro (define_dependency_libs TARGET)
     # ThirdParty/SDL external dependency
     if (${TARGET} MATCHES SDL|Urho3D)
         if (WIN32)
-            list (APPEND LINK_LIBS_ONLY user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
+            list (APPEND LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
         elseif (APPLE)
-            list (APPEND LINK_LIBS_ONLY dl pthread)
+            list (APPEND LIBS dl pthread)
         elseif (ANDROID)
-            list (APPEND LINK_LIBS_ONLY dl log android)
+            list (APPEND LIBS dl log android)
         else ()
             # Linux
-            list (APPEND LINK_LIBS_ONLY dl pthread rt)
+            list (APPEND LIBS dl pthread rt)
             if (RPI)
                 list (APPEND ABSOLUTE_PATH_LIBS ${BCM_VC_LIBRARIES})
             endif ()
@@ -789,16 +788,16 @@ macro (define_dependency_libs TARGET)
     # ThirdParty/kNet & ThirdParty/Civetweb external dependency
     if (${TARGET} MATCHES Civetweb|kNet|Urho3D)
         if (WIN32)
-            list (APPEND LINK_LIBS_ONLY ws2_32)
+            list (APPEND LIBS ws2_32)
         elseif (NOT ANDROID)
-            list (APPEND LINK_LIBS_ONLY pthread)
+            list (APPEND LIBS pthread)
         endif ()
     endif ()
 
     # Urho3D/LuaJIT external dependency
     if (URHO3D_LUAJIT AND ${TARGET} MATCHES LuaJIT|Urho3D)
         if (NOT WIN32)
-            list (APPEND LINK_LIBS_ONLY dl m)
+            list (APPEND LIBS dl m)
         endif ()
     endif ()
 
@@ -806,29 +805,29 @@ macro (define_dependency_libs TARGET)
     if (${TARGET} STREQUAL Urho3D)
         # Core
         if (WIN32)
-            list (APPEND LINK_LIBS_ONLY winmm)
+            list (APPEND LIBS winmm)
             if (URHO3D_MINIDUMPS)
-                list (APPEND LINK_LIBS_ONLY dbghelp)
+                list (APPEND LIBS dbghelp)
             endif ()
         elseif (NOT ANDROID)
-            list (APPEND LINK_LIBS_ONLY pthread)
+            list (APPEND LIBS pthread)
         endif ()
 
         # Graphics
         if (URHO3D_OPENGL)
             if (WIN32)
-                list (APPEND LINK_LIBS_ONLY opengl32)
+                list (APPEND LIBS opengl32)
             elseif (ANDROID)
-                list (APPEND LINK_LIBS_ONLY GLESv1_CM GLESv2)
+                list (APPEND LIBS GLESv1_CM GLESv2)
             elseif (NOT APPLE AND NOT RPI)
-                list (APPEND LINK_LIBS_ONLY GL)
+                list (APPEND LIBS GL)
             endif ()
         else ()
             if (DIRECT3D_FOUND)
                 list (APPEND ABSOLUTE_PATH_LIBS ${DIRECT3D_LIBRARIES})
             else ()
                 # If SDK not found, assume the libraries are found from default directories
-                list (APPEND LINK_LIBS_ONLY ${DIRECT3D_LIBRARIES})
+                list (APPEND LIBS ${DIRECT3D_LIBRARIES})
             endif ()
         endif ()
 

+ 1 - 1
Source/Samples/CMakeLists.txt

@@ -31,7 +31,7 @@ include_directories (${URHO3D_INCLUDE_DIRS})
 set (COMMON_SAMPLE_H_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Sample.h" "${CMAKE_CURRENT_SOURCE_DIR}/Sample.inl")
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_SOURCE_DIR})
+set (INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
 
 # Add samples
 add_subdirectory (01_HelloWorld)

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

@@ -52,7 +52,7 @@ endif ()
 set (SOURCE_FILES ${CPP_FILES} ${ASM_FILES} ${H_FILES})
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY include)
+set (INCLUDE_DIRS include)
 
 # Setup target
 setup_library ()

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

@@ -180,7 +180,7 @@ source_group(Include FILES ${BOX2D_General_HDRS})
 source_group(Rope FILES ${BOX2D_Rope_SRCS} ${BOX2D_Rope_HDRS})
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY .)
+set (INCLUDE_DIRS .)
 
 # Setup target
 setup_library ()

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

@@ -41,7 +41,7 @@ file (GLOB H_FILES *.h src/BulletCollision/BroadphaseCollision/*.h
 set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY src)
+set (INCLUDE_DIRS src)
 
 # Setup target
 setup_library ()

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

@@ -27,7 +27,7 @@ set (TARGET_NAME Civetweb)
 define_source_files (GLOB_CPP_PATTERNS src/*.c GLOB_H_PATTERNS include/*.h)
 
 # Define include directory
-set (INCLUDE_DIRS_ONLY include)
+set (INCLUDE_DIRS include)
 
 # Setup target
 setup_library ()

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

@@ -27,7 +27,7 @@ set (TARGET_NAME Detour)
 define_source_files (GLOB_CPP_PATTERNS source/*.cpp GLOB_H_PATTERNS include/*.h)
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY include)
+set (INCLUDE_DIRS include)
 
 # Setup target
 setup_library ()

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

@@ -74,7 +74,7 @@ set (SOURCE_FILES
     src/winfonts/winfnt.c)
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY include)
+set (INCLUDE_DIRS include)
 
 # Setup target
 setup_library ()

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

@@ -27,7 +27,7 @@ set (TARGET_NAME GLEW)
 define_source_files (GLOB_CPP_PATTERNS *.c)
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY .)
+set (INCLUDE_DIRS .)
 
 # Setup target
 setup_library ()

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

@@ -38,7 +38,7 @@ define_source_files (GLOB_CPP_PATTERNS src/*.c GLOB_H_PATTERNS src/*.h)
 list (APPEND SOURCE_FILES ${ASM_FILES})
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY src)
+set (INCLUDE_DIRS src)
 
 # Setup target
 setup_library ()

+ 2 - 2
Source/ThirdParty/Lua/CMakeLists.txt

@@ -41,9 +41,9 @@ if (NOT IOS)
     set (SOURCE_FILES src/lua.c)
 
     # Define dependency libs
-    set (LINK_LIBS_ONLY Lua)
+    set (LIBS Lua)
     if (NOT MSVC)
-        list (APPEND LINK_LIBS_ONLY m)
+        list (APPEND LIBS m)
     endif ()
 
     # Setup target

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

@@ -395,7 +395,7 @@ endif ()
 set (SOURCE_FILES ${LJCORE_C} ${GEN_SRCS})
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_BINARY_DIR}/generated)
+set (INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/generated)
 
 # Setup target
 setup_library ()
@@ -412,9 +412,9 @@ if (NOT IOS)
     set (SOURCE_FILES src/luajit.c)
 
     # Define dependency libs
-    set (LINK_LIBS_ONLY LuaJIT)
+    set (LIBS LuaJIT)
     if (NOT MSVC)
-        set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} m)
+        set (LIBS ${LIBS} m)
     endif ()
 
     # Setup target

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

@@ -84,7 +84,7 @@ file (GLOB C_FILES buildvm*.c)
 set (SOURCE_FILES ${C_FILES} ${GEN_ARCH_H})
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_BINARY_DIR} ..)
+set (INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ..)
 
 # All tools must be natively built and output to Bin/tool subdir to differentiate them from platform-specific binaries in the Bin directory
 set_output_directories (${CMAKE_BINARY_DIR}/Bin/tool RUNTIME PDB)

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

@@ -28,7 +28,7 @@ set (SOURCE_FILES ../minilua.c)
 
 # Define dependency libs
 if (NOT MSVC)
-    set (LINK_LIBS_ONLY m)
+    set (LIBS m)
 endif ()
 
 # All tools must be natively built and output to Bin/tool subdir to differentiate them from platform-specific binaries in the Bin directory

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

@@ -27,7 +27,7 @@ set (TARGET_NAME Recast)
 define_source_files (GLOB_CPP_PATTERNS source/*.cpp GLOB_H_PATTERNS include/*.h)
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY include)
+set (INCLUDE_DIRS include)
 
 # Setup target
 setup_library ()

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

@@ -114,7 +114,7 @@ set_source_files_properties (${SYS_C_FILES} PROPERTIES LANGUAGE C)
 set (SOURCE_FILES ${C_FILES} ${SYS_C_FILES} ${H_FILES})
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY include)
+set (INCLUDE_DIRS include)
 
 # Setup target
 setup_library ()

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

@@ -60,7 +60,7 @@ endif ()
 set (SOURCE_FILES ${kNetSourceFiles} ${kNetHeaderFiles})
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY include)
+set (INCLUDE_DIRS include)
 
 # Setup target
 setup_library ()

+ 3 - 4
Source/ThirdParty/toluapp/src/bin/CMakeLists.txt

@@ -61,12 +61,11 @@ file (GLOB H_FILES *.h)
 set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
 
 # Define dependency libs
-set (LIBS ../../../../ThirdParty/Lua${JIT}/src)
-set (LINK_LIBS_ONLY toluapp)
+set (LIBS toluapp Lua${JIT})
 if (NOT MSVC)
-    set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} m)
+    list (APPEND LIBS m)
 endif ()
-set (INCLUDE_DIRS_ONLY ../../include)
+set (INCLUDE_DIRS ../../include ../../../../ThirdParty/Lua${JIT}/src)
 
 # All tools must be natively built and output to Bin/tool subdir to differentiate them from platform-specific binaries in the Bin directory
 set_output_directories (${CMAKE_BINARY_DIR}/Bin/tool RUNTIME PDB)

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

@@ -27,7 +27,7 @@ set (TARGET_NAME toluapp)
 define_source_files (GLOB_CPP_PATTERNS *.c)
 
 # Define dependency libs
-set (INCLUDE_DIRS_ONLY ../../include ../../../Lua${JIT}/src)
+set (INCLUDE_DIRS ../../include ../../../Lua${JIT}/src)
 
 # Setup target
 setup_library ()

+ 2 - 1
Source/Tools/AssetImporter/CMakeLists.txt

@@ -28,7 +28,8 @@ define_source_files ()
 
 # Define dependency libs
 add_subdirectory (../../ThirdParty/Assimp ../../ThirdParty/Assimp)
-set (LIBS ../../ThirdParty/Assimp/include)
+set (LIBS Assimp)
+set (INCLUDE_DIRS ../../ThirdParty/Assimp/include)
 
 # Setup target
 if (APPLE)

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

@@ -27,7 +27,7 @@ set (TARGET_NAME PackageTool)
 define_source_files ()
 
 # Define dependency libs
-set (LIBS ../../ThirdParty/LZ4)
+set (LIBS LZ4)
 
 # Setup target
 if (APPLE)

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

@@ -27,7 +27,7 @@ set (TARGET_NAME RampGenerator)
 define_source_files ()
 
 # Define dependency libs
-set (LIBS ../../ThirdParty/STB)
+set (LIBS STB)
 
 # Setup target
 setup_executable ()

+ 2 - 2
Source/Tools/RampGenerator/RampGenerator.cpp

@@ -29,8 +29,8 @@
 #include <windows.h>
 #endif
 
-#include <stb_image.h>
-#include <stb_image_write.h>
+#include <STB/stb_image.h>
+#include <STB/stb_image_write.h>
 
 #include <Urho3D/DebugNew.h>
 

+ 5 - 5
Source/Urho3D/CMakeLists.txt

@@ -134,15 +134,15 @@ set_source_files_properties (${ALL_OBJ_FILES} PROPERTIES GENERATED TRUE)
 # Add include directories to find the precompiled header, export header, and installed headers from thirdparty libs
 # Hack: the ${CMAKE_CURRENT_SOURCE_DIR}/generated is added so that "../Urho3D.h" include path could be resolved back to CMAKE_CURRENT_BINARY_DIR where this generated header is located
 #       the "../Urho3D.h" relative path is preferred over "Urho3D.h" because we want to avoid adding "include/Urho3D" into the search path when *using* the library
-set (INCLUDE_DIRS_ONLY ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/generated ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
+set (INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/generated ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
 if (URHO3D_PHYSICS)
     # Bullet library depends on its own include dir to be added in the header search path
     # This is more practical than patching its header files in many places to make them work with relative path
-    list (APPEND INCLUDE_DIRS_ONLY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Bullet)
+    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Bullet)
 endif ()
 if (URHO3D_LUA)
     # ditto for Lua/LuaJIT
-    list (APPEND INCLUDE_DIRS_ONLY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Lua${JIT})
+    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Lua${JIT})
 endif ()
 
 # Setup library output path
@@ -283,11 +283,11 @@ if (MSVC)
     # todo: Add a post build command to adjust the LIB_NAME when in Debug configuration (CMake/VS generator is multi-config)
     set (DASH /)
     set (LIB_DIR "/LIBPATH:\"\${libdir}\"")
-    string (REPLACE ";" ".lib\" \"" URHO3D_LIBS "\"${LIB_NAME};${LINK_LIBS_ONLY}.lib\"")
+    string (REPLACE ";" ".lib\" \"" URHO3D_LIBS "\"${LIB_NAME};${LIBS}.lib\"")
 else ()
     set (DASH -)
     set (LIB_DIR "-L\"\${libdir}\"")
-    string (REPLACE ";" " -l" URHO3D_LIBS "-l${LIB_NAME};${LINK_LIBS_ONLY}")
+    string (REPLACE ";" " -l" URHO3D_LIBS "-l${LIB_NAME};${LIBS}")
 endif ()
 string (REPLACE ";" " ${DASH}D" URHO3D_COMPILE_DEFINITIONS ";${URHO3D_COMPILE_DEFINITIONS}")
 get_directory_property (GLOBAL_INCLUDE_DIRS DIRECTORY ${CMAKE_SOURCE_DIR} INCLUDE_DIRECTORIES)