+find_path (APITRACE_SOURCE_DIR NAMES cmake/FindDirectX.cmake PATHS .. ../.. DOC "apitrace source tree" NO_DEFAULT_PATH)
+if (NOT EXISTS ${APITRACE_SOURCE_DIR})
+ message (SEND_ERROR "Please specify path to apitrace source tree via APITRACE_SOURCE_DIR")
+endif ()
+
+find_program (APITRACE_EXECUTABLE NAMES apitrace PATHS ${APITRACE_SOURCE_DIR} DOC "apitrace executable")
+if (NOT EXISTS ${APITRACE_EXECUTABLE})
+ message (SEND_ERROR "Please specify path to apitrace executable via APITRACE_EXECUTABLE")
+endif ()
+
+include (FindPkgConfig)
+
+if (APITRACE_SOURCE_DIR)
+ set (CMAKE_MODULE_PATH ${APITRACE_SOURCE_DIR}/cmake)
+ find_package (DirectX)
+endif ()
+
+# Set default built type
+if (NOT CMAKE_BUILD_TYPE)
+ set (CMAKE_BUILD_TYPE Debug
+ CACHE
+ STRING "Choose the build type, options are: None, Debug, Release, RelWithDebInfo, or MinSizeRel."
+ FORCE)
+endif (NOT CMAKE_BUILD_TYPE)
+
+include (CMakeParseArguments)
+