diff --git a/CMakeLists.txt b/CMakeLists.txt index 51e46aa9..60d6b83c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,6 +198,8 @@ endif ( RTA_INSTALL_DATABASE ) set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/ CACHE PATH "Location of header files" ) +export( EXPORT RAWTOACESTargets ) + install( EXPORT RAWTOACESTargets FILE RAWTOACESTargets.cmake DESTINATION lib/cmake/RAWTOACES diff --git a/config/RAWTOACESConfig.cmake.in b/config/RAWTOACESConfig.cmake.in index 38bf4503..68da585e 100644 --- a/config/RAWTOACESConfig.cmake.in +++ b/config/RAWTOACESConfig.cmake.in @@ -7,12 +7,17 @@ set(rawtoaces_VERSION "@RAWTOACES_VERSION@") include(${CMAKE_CURRENT_LIST_DIR}/RAWTOACESTargets.cmake) include(CMakeFindDependencyMacro) - -if ( @RTA_ENABLE_EIGEN@ ) - find_dependency ( Eigen3 ) -endif () -find_dependency ( Ceres ) + find_dependency ( OpenImageIO ) + +if ( NOT @ENABLE_SHARED@ ) + find_dependency ( nlohmann_json ) + if ( @RTA_ENABLE_EIGEN@ ) + find_dependency ( Eigen3 ) + endif () + + find_dependency ( Ceres ) +endif ( NOT @ENABLE_SHARED@ ) check_required_components(rawtoaces) diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt index d775ff22..c1117d2b 100644 --- a/src/bindings/CMakeLists.txt +++ b/src/bindings/CMakeLists.txt @@ -34,8 +34,5 @@ set_target_properties( rawtoaces_bindings PROPERTIES install( TARGETS rawtoaces_bindings - EXPORT RAWTOACESTargets LIBRARY DESTINATION ${INSTALL_LIB_DIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - PUBLIC_HEADER DESTINATION include/rawtoaces ) diff --git a/src/rawtoaces/main.cpp b/src/rawtoaces/main.cpp index 2e1f817b..0fb45c56 100644 --- a/src/rawtoaces/main.cpp +++ b/src/rawtoaces/main.cpp @@ -40,7 +40,7 @@ void update_error_message( std::string &error_message ) int main( int argc, const char *argv[] ) { #ifndef WIN32 - putenv( (char *)"TZ=UTC" ); + setenv( "TZ", "UTC", 1 ); #else _putenv( (char *)"TZ=UTC" ); #endif diff --git a/src/rawtoaces_core/CMakeLists.txt b/src/rawtoaces_core/CMakeLists.txt index ae1a4124..3ce7d1f3 100644 --- a/src/rawtoaces_core/CMakeLists.txt +++ b/src/rawtoaces_core/CMakeLists.txt @@ -30,15 +30,15 @@ target_link_libraries( ) if ( RTA_ENABLE_EIGEN ) - target_link_libraries( ${RAWTOACES_CORE_LIB} PUBLIC Eigen3::Eigen ) + target_link_libraries( ${RAWTOACES_CORE_LIB} PRIVATE Eigen3::Eigen ) target_compile_definitions(${RAWTOACES_CORE_LIB} PRIVATE RTA_ENABLE_EIGEN=1 ) endif ( RTA_ENABLE_EIGEN ) if ( ${Ceres_VERSION_MAJOR} GREATER 1 ) - target_link_libraries( ${RAWTOACES_CORE_LIB} PUBLIC Ceres::ceres ) + target_link_libraries( ${RAWTOACES_CORE_LIB} PRIVATE Ceres::ceres ) else () - target_include_directories(${RAWTOACES_CORE_LIB} PUBLIC ${CERES_INCLUDE_DIRS}) - target_link_libraries(${RAWTOACES_CORE_LIB} PUBLIC ${CERES_LIBRARIES}) + target_include_directories(${RAWTOACES_CORE_LIB} PRIVATE ${CERES_INCLUDE_DIRS}) + target_link_libraries(${RAWTOACES_CORE_LIB} PRIVATE ${CERES_LIBRARIES}) endif () target_include_directories( ${RAWTOACES_CORE_LIB} PUBLIC diff --git a/src/rawtoaces_core/rawtoaces_core.cpp b/src/rawtoaces_core/rawtoaces_core.cpp index 95df5413..0ca3ab99 100644 --- a/src/rawtoaces_core/rawtoaces_core.cpp +++ b/src/rawtoaces_core/rawtoaces_core.cpp @@ -57,7 +57,7 @@ void calculate_daylight_SPD( const int &cct_input, Spectrum &spectrum ) constexpr size_t count = sizeof( s_series ) / sizeof( s_series[0] ); assert( count == 54 ); assert( - ( s_series[1].wl - s_series[0].wl ) * ( count - 1 ) == + ( s_series[1].wl - s_series[0].wl ) * (int)( count - 1 ) == ( s_series[53].wl - s_series[0].wl ) ); double cct; diff --git a/tests/config_tests/CMakeLists.txt b/tests/config_tests/CMakeLists.txt index 72fb0799..d299f9c2 100644 --- a/tests/config_tests/CMakeLists.txt +++ b/tests/config_tests/CMakeLists.txt @@ -11,25 +11,13 @@ cmake_minimum_required(VERSION 3.10) project( rawtoaces_config_test ) - -# Until we get some of these modules into the upstream packages, put them here -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../../cmake/modules/") -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_INSTALL_PREFIX}/share/CMake") - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_compile_options ( /W0 ) add_compile_options ( /utf-8 ) add_compile_definitions( NOMINMAX ) endif() -# the Ceres::ceres alias in not getting defined on the config side -find_package ( Ceres CONFIG REQUIRED ) -find_package ( OpenImageIO CONFIG REQUIRED ) - -# Windows build seems to expose nlohmann_json as dependency? -find_package ( nlohmann_json CONFIG REQUIRED ) - -find_package ( RAWTOACES CONFIG REQUIRED ) +find_package ( RAWTOACES CONFIG REQUIRED ) enable_testing() add_subdirectory(core) diff --git a/tests/config_tests/util/test_installed_util.cpp b/tests/config_tests/util/test_installed_util.cpp index 50decc7d..32324c88 100644 --- a/tests/config_tests/util/test_installed_util.cpp +++ b/tests/config_tests/util/test_installed_util.cpp @@ -8,10 +8,10 @@ #endif #include -#include - #include +#include + void test_AcesRender() { const char *argv[] = {