La Chamelle
La Chamelle

Reputation: 2967

Find Microsoft SDK (psapi.lib) with Cmake and or qmake

i have an application where is use Qt 4.6 and Microsoft SDKs (the Psapi.Lib).

I use cmake or qmake to build.

For qmake and cmake i specify in hard the path of the Psapi.lib.

qmake :

win32 {
    LIBS += "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Psapi.Lib"
}

cmake :

SET(PSAPI "C:/Program Files/Microsoft SDKs/Windows/v7.0A/Lib/Psapi.Lib")

But i want to avoid the hard path, is there is any way to search the SDK lib ?

For linux, there is no problem to search :

qmake :

unix {
    CONFIG += link_pkgconfig
    PKGCONFIG += xmu
}

cmake :

IF(UNIX)
  INCLUDE(FindPkgConfig)
  PKG_CHECK_MODULES(XMU xmu REQUIRED)
  INCLUDE_DIRECTORIES(${XMU_INCLUDE_DIR})
  LINK_DIRECTORIES(${XMU_LIBRARY_DIRS})
ENDIF()

It's possible to make the same ? Thanks you.

Upvotes: 0

Views: 3622

Answers (2)

Tarc
Tarc

Reputation: 3322

I have succeeded in finding Psapi.Lib on a Windows 7 with the following:

find_library (PSAPI Psapi)

but I'm having trouble making it find for the proper architecture. It always find the x32 version:

find_library (PSAPI Psapi PATH_SUFFIXES "x64")
message (STATUS "PSAPI: ${PSAPI}")
> -- PSAPI: C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86/Psapi.Lib

:(

Upvotes: 0

Bill Hoffman
Bill Hoffman

Reputation: 1762

See find_library command in CMake.

Upvotes: 0

Related Questions