diff --git a/CMakeLists.txt b/CMakeLists.txt index 6612e939305..17a626cfa89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1755,6 +1755,8 @@ endif() if(WITH_COMPILER_SHORT_FILE_MACRO) # Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this). + set(C_PREFIX_MAP_FLAGS "") + set(CXX_PREFIX_MAP_FLAGS "") add_check_c_compiler_flag(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar) add_check_cxx_compiler_flag(CXX_PREFIX_MAP_FLAGS CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar) if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP) @@ -1789,6 +1791,8 @@ if(WITH_COMPILER_SHORT_FILE_MACRO) ) set(WITH_COMPILER_SHORT_FILE_MACRO OFF) endif() + unset(C_PREFIX_MAP_FLAGS) + unset(CXX_PREFIX_MAP_FLAGS) endif() # Include warnings first, so its possible to disable them with user defined flags diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake index e1a07a6d611..55c192cf24e 100644 --- a/build_files/cmake/Modules/GTestTesting.cmake +++ b/build_files/cmake/Modules/GTestTesting.cmake @@ -39,6 +39,8 @@ macro(BLENDER_SRC_GTEST_EX) unset(_current_include_directories) if(WIN32) set(MANIFEST "${CMAKE_BINARY_DIR}/tests.exe.manifest") + else() + set(MANIFEST "") endif() add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST}) @@ -63,10 +65,13 @@ macro(BLENDER_SRC_GTEST_EX) bf_intern_guardedalloc extern_gtest extern_gmock - # needed for glog - ${PTHREADS_LIBRARIES} + # Needed for GLOG. ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES}) + + if(DEFINED PTHREADS_LIBRARIES) # Needed for GLOG. + target_link_libraries(${TARGET_NAME} PRIVATE ${PTHREADS_LIBRARIES}) + endif() if(WITH_OPENMP_STATIC) target_link_libraries(${TARGET_NAME} PRIVATE ${OpenMP_LIBRARIES}) endif() @@ -102,8 +107,8 @@ macro(BLENDER_SRC_GTEST_EX) endif() if(WIN32) set_target_properties(${TARGET_NAME} PROPERTIES VS_GLOBAL_VcpkgEnabled "false") - unset(MANIFEST) endif() + unset(MANIFEST) unset(TEST_INC) unset(TEST_INC_SYS) unset(TARGET_NAME) diff --git a/intern/atomic/CMakeLists.txt b/intern/atomic/CMakeLists.txt index 39f29be97ae..56bab651a8c 100644 --- a/intern/atomic/CMakeLists.txt +++ b/intern/atomic/CMakeLists.txt @@ -8,6 +8,8 @@ set(INC set(INC_SYS ) +set(LIB +) add_library(bf_intern_atomic INTERFACE) diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt index 3c394176afe..9604f78298d 100644 --- a/intern/guardedalloc/CMakeLists.txt +++ b/intern/guardedalloc/CMakeLists.txt @@ -49,8 +49,10 @@ if(WIN32 AND NOT UNIX) endif() # Jemalloc 5.0.0+ needs extra configuration. -if(WITH_MEM_JEMALLOC AND NOT ("${JEMALLOC_VERSION}" VERSION_LESS "5.0.0")) - add_definitions(-DWITH_JEMALLOC_CONF) +if(WITH_MEM_JEMALLOC) + if(NOT ("${JEMALLOC_VERSION}" VERSION_LESS "5.0.0")) + add_definitions(-DWITH_JEMALLOC_CONF) + endif() endif() blender_add_lib(bf_intern_guardedalloc "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/asset_system/CMakeLists.txt b/source/blender/asset_system/CMakeLists.txt index 65b8cf6026d..3064ceb9fca 100644 --- a/source/blender/asset_system/CMakeLists.txt +++ b/source/blender/asset_system/CMakeLists.txt @@ -49,6 +49,8 @@ set(LIB blender_add_lib(bf_asset_system "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") if(WITH_GTESTS) + set(TEST_INC + ) set(TEST_SRC tests/asset_catalog_path_test.cc tests/asset_catalog_test.cc diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 9ad787db3c8..ebf9141ed7d 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -18,7 +18,6 @@ set(INC_SYS ${EIGEN3_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIRS} - ${GMP_INCLUDE_DIRS} ) set(SRC diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index a38adc98189..3a51c4906a8 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -171,6 +171,8 @@ blender_add_lib(bf_depsgraph "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") add_dependencies(bf_depsgraph bf_rna) if(WITH_GTESTS) + set(TEST_INC + ) set(TEST_SRC intern/builder/deg_builder_rna_test.cc ) diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt index f6fbbdffc62..822b8a7709d 100644 --- a/source/blender/functions/CMakeLists.txt +++ b/source/blender/functions/CMakeLists.txt @@ -71,6 +71,8 @@ endif() blender_add_lib(bf_functions "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") if(WITH_GTESTS) + set(TEST_INC + ) set(TEST_SRC tests/FN_field_test.cc tests/FN_lazy_function_test.cc diff --git a/source/blender/imbuf/intern/oiio/CMakeLists.txt b/source/blender/imbuf/intern/oiio/CMakeLists.txt index bf1b1a0cef6..c0e975fb89a 100644 --- a/source/blender/imbuf/intern/oiio/CMakeLists.txt +++ b/source/blender/imbuf/intern/oiio/CMakeLists.txt @@ -24,12 +24,17 @@ set(SRC set(LIB ${OPENIMAGEIO_LIBRARIES} - ${PUGIXML_LIBRARIES} PRIVATE bf::blenlib PRIVATE bf::dna PRIVATE bf::intern::guardedalloc ) +if(WITH_PUGIXML) + list(APPEND LIB + ${PUGIXML_LIBRARIES} + ) +endif() + if(WITH_IMAGE_OPENEXR) list(APPEND INC_SYS ${OPENEXR_INCLUDE_DIRS} diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 559ed72d4c2..8bd6071eba3 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -29,6 +29,8 @@ set(INC # RNA_prototypes.h ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) set(SRC intern/wm.cc