Commit 6bc54ba0 by Matt Clarkson

Use CMake to link Shlwapi on Windows

We use the SHGetValueA on Windows to retrieve the MHz of the processor but this requires the shlwapi library. Previous to this patch the library was linked with a MSVC specific pragma but there is no guarantee that on Windows we will be using MSVC. Therefore, it is much compile agnostic to use the standard CMAKE library linking mechanism to provide the definition of SHGetValueA
parent dd61391c
...@@ -32,6 +32,11 @@ set_target_properties(benchmark PROPERTIES ...@@ -32,6 +32,11 @@ set_target_properties(benchmark PROPERTIES
SOVERSION ${GENERIC_LIB_SOVERSION} SOVERSION ${GENERIC_LIB_SOVERSION}
) )
# We need extra libraries on Windows
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(benchmark Shlwapi)
endif()
# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable) # Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
install( install(
TARGETS benchmark TARGETS benchmark
......
...@@ -233,7 +233,6 @@ void InitializeSystemInfo() { ...@@ -233,7 +233,6 @@ void InitializeSystemInfo() {
// TODO: also figure out cpuinfo_num_cpus // TODO: also figure out cpuinfo_num_cpus
#elif defined OS_WINDOWS #elif defined OS_WINDOWS
#pragma comment(lib, "shlwapi.lib") // for SHGetValue()
// In NT, read MHz from the registry. If we fail to do so or we're in win9x // In NT, read MHz from the registry. If we fail to do so or we're in win9x
// then make a crude estimate. // then make a crude estimate.
OSVERSIONINFO os; OSVERSIONINFO os;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment