overte-JulianGro/libraries/shared/CMakeLists.txt
Dale Glass 32c3725b5d Define _USE_MATH_DEFINES everywhere that uses math constants
On Win32, things are failing to build with messages like:

RenderableEntityItem.cpp(674,51): error C2065: 'M_PI': undeclared identifier

This is because as per Microsoft documentation, _USE_MATH_DEFINES is needed to
obtain constants like M_PI:

https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants?view=msvc-160

It seems this worked previously due to some quirk of CMake, but stopped working
after some reordering. This change makes this definition explicit where it is needed.
2021-07-17 19:34:26 +02:00

27 lines
777 B
CMake

set(TARGET_NAME shared)
include_directories("${QT_DIR}/include/QtCore/${QT_VERSION}/QtCore" "${QT_DIR}/include/QtCore/${QT_VERSION}")
# TODO: there isn't really a good reason to have Script linked here - let's get what is requiring it out (RegisteredMetaTypes.cpp)
setup_hifi_library(Gui Network Script)
if (WIN32)
target_link_libraries(${TARGET_NAME} Wbemuuid.lib)
add_compile_definitions(_USE_MATH_DEFINES)
endif()
if (ANDROID)
target_link_libraries(${TARGET_NAME} android)
endif()
if (APPLE)
find_library(FRAMEWORK_IOKIT IOKit)
find_library(CORE_FOUNDATION CoreFoundation)
find_library(OpenGL OpenGL)
target_link_libraries(${TARGET_NAME} ${FRAMEWORK_IOKIT} ${CORE_FOUNDATION} ${OpenGL})
endif()
target_zlib()
target_nsight()
target_json()