FindDiaSDK.cmake 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Find the DIA SDK path.
  2. get_filename_component(VS_PATH32 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]" ABSOLUTE CACHE)
  3. get_filename_component(VS_PATH64 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\VisualStudio\\14.0;InstallDir]" ABSOLUTE CACHE)
  4. # VS_PATH32 will be something like C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE
  5. # Also look for in vs15 install.
  6. # TODO: update this to be a non-hardcoded path. Registry keys were removed
  7. # in vs15 in favor of COM server dlls.
  8. # https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studio-15-setup/
  9. get_filename_component(VS15_C_PATH32 "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE" ABSOLUTE CACHE)
  10. get_filename_component(VS15_P_PATH32 "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE" ABSOLUTE CACHE)
  11. get_filename_component(VS15_E_PATH32 "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE" ABSOLUTE CACHE)
  12. # Find the TAEF path, it will typically look something like this.
  13. # C:\Program Files (x86)\Microsoft Visual Studio 14.0\DIA SDK\include\dia2.h
  14. find_path(DIASDK_INCLUDE_DIR # Set variable DIASDK_INCLUDE_DIR
  15. dia2.h # Find a path with dia2.h
  16. HINTS "${VS_PATH64}/../../DIA SDK/include"
  17. HINTS "${VS_PATH32}/../../DIA SDK/include"
  18. HINTS "${VS15_C_PATH32}/../../DIA SDK/include"
  19. HINTS "${VS15_P_PATH32}/../../DIA SDK/include"
  20. HINTS "${VS15_E_PATH32}/../../DIA SDK/include"
  21. DOC "path to DIA SDK header files"
  22. HINTS
  23. )
  24. if (CMAKE_GENERATOR MATCHES "Visual Studio.*Win64" )
  25. find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib
  26. HINTS ${DIASDK_INCLUDE_DIR}/../lib/amd64 )
  27. elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" )
  28. find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib
  29. HINTS ${DIASDK_INCLUDE_DIR}/../lib/arm )
  30. else (CMAKE_GENERATOR MATCHES "Visual Studio.*Win64" )
  31. find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib
  32. HINTS ${DIASDK_INCLUDE_DIR}/../lib )
  33. endif (CMAKE_GENERATOR MATCHES "Visual Studio.*Win64" )
  34. set(DIASDK_LIBRARIES ${DIASDK_GUIDS_LIBRARY})
  35. set(DIASDK_INCLUDE_DIRS ${DIASDK_INCLUDE_DIR})
  36. include(FindPackageHandleStandardArgs)
  37. # handle the QUIETLY and REQUIRED arguments and set DIASDK_FOUND to TRUE
  38. # if all listed variables are TRUE
  39. find_package_handle_standard_args(DIASDK DEFAULT_MSG
  40. DIASDK_LIBRARIES DIASDK_INCLUDE_DIR)
  41. mark_as_advanced(DIASDK_INCLUDE_DIRS DIASDK_LIBRARIES)