Browse Source

Explicitly specify a base name for the export header generation.

The library target is renamed from "Urho3D" to "Urho3D_lib" as it clashes with "Urho3D" target for script host application. The library target's output name is then adjusted back "Urho3D" in the macro to generate "libUrho3D.a" or "libUrho3D.so" or "Urho3D.dll", etc. However, it seems that generate_export_header() macro provided by CMake does not taken into consideration of the adjusted target's output name property. Fortunately, it accepts a BASE_NAME argument to rectify the problem cleanly.
Yao Wei Tjong 姚伟忠 12 years ago
parent
commit
07f81edc6f
2 changed files with 3 additions and 3 deletions
  1. 1 1
      Source/CMake/Modules/Urho3D-CMake-magic.cmake
  2. 2 2
      Source/Engine/CMakeLists.txt

+ 1 - 1
Source/CMake/Modules/Urho3D-CMake-magic.cmake

@@ -88,7 +88,7 @@ if (URHO3D_LIB_TYPE)
     string (TOUPPER ${URHO3D_LIB_TYPE} URHO3D_LIB_TYPE)
 endif ()
 if (NOT URHO3D_LIB_TYPE STREQUAL SHARED)
-    add_definitions (-DURHO3D_LIB_STATIC_DEFINE)
+    add_definitions (-DURHO3D_STATIC_DEFINE)
 endif ()
 
 # If using Windows and not OpenGL, find DirectX SDK include & library directories

+ 2 - 2
Source/Engine/CMakeLists.txt

@@ -126,8 +126,8 @@ endif ()
 # Generate platform specific export header file automatically
 if (NOT URHO3D_LIB_TYPE STREQUAL URHO3D_EXPORTS_BUILD_TYPE OR ${CMAKE_CURRENT_SOURCE_DIR}/Urho3D.h.in IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h)
     set_target_properties (${TARGET_NAME} PROPERTIES DEFINE_SYMBOL URHO3D_EXPORTS)
-    generate_export_header (${TARGET_NAME} EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Urho3D.h)
-    set (URHO3D_EXPORTS_BUILD_TYPE ${URHO3D_LIB_TYPE} CACHE INTERNAL "Build type when Urho3D export header was last generated")
+    generate_export_header (${TARGET_NAME} BASE_NAME ${LIB_NAME} EXPORT_MACRO_NAME URHO3D_API EXPORT_FILE_NAME Urho3D.h)
+    set (URHO3D_EXPORTS_BUILD_TYPE ${URHO3D_LIB_TYPE} CACHE INTERNAL "Lib type when Urho3D export header was last generated")
     
     # Append Urho3D license notice to the export header file
     file (READ ${CMAKE_CURRENT_BINARY_DIR}/Urho3D.h EXPORT_DEFINE)