Skip to content

Commit 633d83e

Browse files
authored
Ensure that M_PI is defined in any downstream compilation unit in Windows (#44)
1 parent 54ad72b commit 633d83e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

angles/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ find_package(ament_cmake REQUIRED)
1616
add_library(angles INTERFACE)
1717
target_include_directories(angles INTERFACE
1818
"$<INSTALL_INTERFACE:include/angles>")
19+
if(WIN32)
20+
target_compile_definitions(angles INTERFACE _USE_MATH_DEFINES)
21+
endif()
1922

2023
if(BUILD_TESTING)
2124
find_package(ament_cmake_gtest REQUIRED)

angles/include/angles/angles.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
#ifndef GEOMETRY_ANGLES_UTILS_H
3636
#define GEOMETRY_ANGLES_UTILS_H
3737

38+
#ifndef _USE_MATH_DEFINES
3839
#define _USE_MATH_DEFINES
40+
#endif
41+
3942
#include <algorithm>
4043
#include <cmath>
4144

0 commit comments

Comments
 (0)