From 401de4719a4d3e9791b4f4d4677e477eeac2c832 Mon Sep 17 00:00:00 2001 From: jasjuang Date: Fri, 8 Nov 2019 09:23:03 -0800 Subject: [PATCH] use target_compile_definitions for TINYOBJLOADER_USE_DOUBLE to avoid the need for defining again in downstream --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 74a1f7a4..32eb7b1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,6 @@ set(TINYOBJLOADER_VERSION 1.0.4) option(TINYOBJLOADER_USE_DOUBLE "Build library with double precision instead of single (float)" OFF) if(TINYOBJLOADER_USE_DOUBLE) - add_definitions(-DTINYOBJLOADER_USE_DOUBLE) set(LIBRARY_NAME ${PROJECT_NAME}_double) else() set(LIBRARY_NAME ${PROJECT_NAME}) @@ -56,6 +55,10 @@ if(BUILD_SHARED_LIBS) ) endif() +if(TINYOBJLOADER_USE_DOUBLE) + target_compile_definitions(${LIBRARY_NAME} PUBLIC TINYOBJLOADER_USE_DOUBLE) +endif() + set_target_properties(${LIBRARY_NAME} PROPERTIES VERSION ${TINYOBJLOADER_VERSION}) target_include_directories(${LIBRARY_NAME} INTERFACE