Use more standard names on FindDirectX.cmake
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 22 Nov 2010 13:00:54 +0000 (13:00 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 22 Nov 2010 13:00:54 +0000 (13:00 +0000)
CMakeLists.txt
cmake/FindDirectX.cmake

index 2642708..bae9680 100644 (file)
@@ -20,7 +20,7 @@ find_path (GLEW_INCLUDE_DIR GL/glew.h
       /usr/include/GL
 )
 
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (WIN32)
        # Nobody likes to include windows.h:
        # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
        # - GLEW temporarily defines the necessary defines but undefines them later
@@ -41,7 +41,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
        add_definitions (-DGLAPIENTRY=__stdcall)
 
        link_libraries (winmm)
-endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+endif (WIN32)
 
 if (MSVC)
        # Enable math constants defines
@@ -84,10 +84,10 @@ endif (NOT ZLIB_FOUND)
 
 include_directories (${CMAKE_CURRENT_SOURCE_DIR})
 
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if (WIN32)
        # d3d8.dll
-       if (D3D8_FOUND)
-               include_directories (${D3D8_INCLUDE_DIR})
+       if (DirectX_D3D8_FOUND)
+               include_directories (${DirectX_D3D8_INCLUDE_DIR})
                add_custom_command (
                        OUTPUT d3d8.cpp
                        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d8.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d8.cpp
@@ -95,11 +95,11 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
                )
                add_library (d3d8 SHARED d3d8.def d3d8.cpp log.cpp os_win32.cpp)
                set_target_properties (d3d8 PROPERTIES PREFIX "")
-       endif (D3D8_FOUND)
+       endif (DirectX_D3D8_FOUND)
 
        # d3d9.dll
-       if (D3DX9_FOUND)
-               include_directories (${D3DX9_INCLUDE_DIR})
+       if (DirectX_D3DX9_FOUND)
+               include_directories (${DirectX_D3DX9_INCLUDE_DIR})
                add_custom_command (
                        OUTPUT d3d9.cpp
                        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d9.cpp
@@ -107,11 +107,11 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
                )
                add_library (d3d9 SHARED d3d9.def d3d9.cpp log.cpp os_win32.cpp)
                set_target_properties (d3d9 PROPERTIES PREFIX "")
-       endif (D3DX9_FOUND)
+       endif (DirectX_D3DX9_FOUND)
 
        # d3d10.dll
-       if (D3D10_FOUND)
-               include_directories (${D3D10_INCLUDE_DIR})
+       if (DirectX_D3D10_FOUND)
+               include_directories (${DirectX_D3D10_INCLUDE_DIR})
                add_custom_command (
                        OUTPUT d3d10.cpp
                        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10misc.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10.cpp
@@ -119,7 +119,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
                )
                add_library (d3d10 SHARED d3d10.def d3d10.cpp log.cpp os_win32.cpp)
                set_target_properties (d3d10 PROPERTIES PREFIX "")
-       endif (D3D10_FOUND)
+       endif (DirectX_D3D10_FOUND)
 
        # opengl32.dll
        add_custom_command (
index 7e420be..1ad00b1 100644 (file)
 # - try to find DirectX include dirs and libraries
 
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-       find_path (D3D8_INCLUDE_DIR d3d8.h
+       find_path (DirectX_D3D8_INCLUDE_DIR d3d8.h
                PATHS
                        "$ENV{DXSDK_DIR}/Include"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Include"
                DOC "The directory where d3d8.h resides")
 
-       find_path (D3DX8_INCLUDE_DIR d3dx8.h
+       find_path (DirectX_D3DX8_INCLUDE_DIR d3dx8.h
                PATHS
                        "$ENV{DXSDK_DIR}/Include"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Include"
                DOC "The directory where d3dx8.h resides")
 
-       find_library (D3D8_LIBRARY d3d8
+       find_library (DirectX_D3D8_LIBRARY d3d8
                PATHS
                        "$ENV{DXSDK_DIR}/Lib/x86"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Lib/x86"
                DOC "The directory where d3d8 resides")
 
-       find_library (D3DX8_LIBRARY d3dx8
+       find_library (DirectX_D3DX8_LIBRARY d3dx8
                PATHS
                        "$ENV{DXSDK_DIR}/Lib/x86"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Lib/x86"
                DOC "The directory where d3dx8 resides")
 
-       if (D3D8_INCLUDE_DIR AND D3D8_LIBRARY)
-               set (D3D8_FOUND 1)
-               if (D3DX8_INCLUDE_DIR AND D3DX8_LIBRARY)
-                       set (D3DX8_FOUND 1)
-               endif (D3DX8_INCLUDE_DIR AND D3DX8_LIBRARY)
-       endif (D3D8_INCLUDE_DIR AND D3D8_LIBRARY)
+       if (DirectX_D3D8_INCLUDE_DIR AND DirectX_D3D8_LIBRARY)
+               set (DirectX_D3D8_FOUND 1)
+               if (DirectX_D3DX8_INCLUDE_DIR AND DirectX_D3DX8_LIBRARY)
+                       set (DirectX_D3DX8_FOUND 1)
+               endif (DirectX_D3DX8_INCLUDE_DIR AND DirectX_D3DX8_LIBRARY)
+       endif (DirectX_D3D8_INCLUDE_DIR AND DirectX_D3D8_LIBRARY)
 
 
-       find_path (D3D9_INCLUDE_DIR d3d9.h
+       find_path (DirectX_D3D9_INCLUDE_DIR d3d9.h
                PATHS
                        "$ENV{DXSDK_DIR}/Include"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Include"
                DOC "The directory where d3d9.h resides")
 
-       find_path (D3DX9_INCLUDE_DIR d3dx9.h
+       find_path (DirectX_D3DX9_INCLUDE_DIR d3dx9.h
                PATHS
                        "$ENV{DXSDK_DIR}/Include"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Include"
                DOC "The directory where d3dx9.h resides")
 
-       find_library (D3D9_LIBRARY d3d9
+       find_library (DirectX_D3D9_LIBRARY d3d9
                PATHS
                        "$ENV{DXSDK_DIR}/Lib/x86"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Lib/x86"
                DOC "The directory where d3d9 resides")
 
-       find_library (D3DX9_LIBRARY d3dx9
+       find_library (DirectX_D3DX9_LIBRARY d3dx9
                PATHS
                        "$ENV{DXSDK_DIR}/Lib/x86"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Lib/x86"
                DOC "The directory where d3dx9 resides")
 
-       if (D3D9_INCLUDE_DIR AND D3D9_LIBRARY)
-               set (D3D9_FOUND 1)
-               if (D3DX9_INCLUDE_DIR AND D3DX9_LIBRARY)
-                       set (D3DX9_FOUND 1)
-               endif (D3DX9_INCLUDE_DIR AND D3DX9_LIBRARY)
-       endif (D3D9_INCLUDE_DIR AND D3D9_LIBRARY)
+       if (DirectX_D3D9_INCLUDE_DIR AND DirectX_D3D9_LIBRARY)
+               set (DirectX_D3D9_FOUND 1)
+               if (DirectX_D3DX9_INCLUDE_DIR AND DirectX_D3DX9_LIBRARY)
+                       set (DirectX_D3DX9_FOUND 1)
+               endif (DirectX_D3DX9_INCLUDE_DIR AND DirectX_D3DX9_LIBRARY)
+       endif (DirectX_D3D9_INCLUDE_DIR AND DirectX_D3D9_LIBRARY)
 
 
-       find_path (D3D10_INCLUDE_DIR d3d10.h
+       find_path (DirectX_D3D10_INCLUDE_DIR d3d10.h
                PATHS
                        "$ENV{DXSDK_DIR}/Include"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Include"
                DOC "The directory where d3d10.h resides")
 
-       find_path (D3DX10_INCLUDE_DIR d3dx10.h
+       find_path (DirectX_D3DX10_INCLUDE_DIR d3dx10.h
                PATHS
                        "$ENV{DXSDK_DIR}/Include"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Include"
                DOC "The directory where d3dx10.h resides")
 
-       find_library (D3D10_LIBRARY d3d10
+       find_library (DirectX_D3D10_LIBRARY d3d10
                PATHS
                        "$ENV{DXSDK_DIR}/Lib/x86"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Lib/x86"
                DOC "The directory where d3d10 resides")
 
-       find_library (D3DX10_LIBRARY d3dx10
+       find_library (DirectX_D3DX10_LIBRARY d3dx10
                PATHS
                        "$ENV{DXSDK_DIR}/Lib/x86"
                        "$ENV{ProgramFiles}/Microsoft DirectX SDK/Lib/x86"
                DOC "The directory where d3dx10 resides")
 
-       if (D3D10_INCLUDE_DIR AND D3D10_LIBRARY)
-               set (D3D10_FOUND 1)
-               if (D3DX10_INCLUDE_DIR AND D3DX10_LIBRARY)
-                       set (D3DX10_FOUND 1)
-               endif (D3DX10_INCLUDE_DIR AND D3DX10_LIBRARY)
-       endif (D3D10_INCLUDE_DIR AND D3D10_LIBRARY)
+       if (DirectX_D3D10_INCLUDE_DIR AND DirectX_D3D10_LIBRARY)
+               set (DirectX_D3D10_FOUND 1)
+               if (DirectX_D3DX10_INCLUDE_DIR AND DirectX_D3DX10_LIBRARY)
+                       set (DirectX_D3DX10_FOUND 1)
+               endif (DirectX_D3DX10_INCLUDE_DIR AND DirectX_D3DX10_LIBRARY)
+       endif (DirectX_D3D10_INCLUDE_DIR AND DirectX_D3D10_LIBRARY)
 
 endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
 
 mark_as_advanced (
-       D3D8_FOUND
-       D3DX8_FOUND
-       D3D9_FOUND
-       D3DX9_FOUND
-       D3D10_FOUND
-       D3DX10_FOUND
+       DirectX_D3D8_FOUND
+       DirectX_D3DX8_FOUND
+       DirectX_D3D9_FOUND
+       DirectX_D3DX9_FOUND
+       DirectX_D3D10_FOUND
+       DirectX_D3DX10_FOUND
 )