This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/datatoc/CMakeLists.txt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.9 KiB
CMake
Raw Normal View History

# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licenses
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# ***** END GPL LICENSE BLOCK *****
# -----------------------------------------------------------------------------
# Build datatoc executable
set(SRC
datatoc.c
)
# SRC_DNA_INC is defined in the parent dir
add_executable(datatoc ${SRC})
# -----------------------------------------------------------------------------
# Build datatoc_icon executable
if(NOT WITH_HEADLESS)
set(SRC
datatoc_icon.c
)
setup_platform_linker_flags(datatoc)
if(WIN32)
include_directories(
../blenlib
../../../intern/utfconv
)
# for winstuff_dir.c
add_definitions(-DUSE_STANDALONE)
list(APPEND SRC
../blenlib/intern/winstuff_dir.c
../../../intern/utfconv/utfconv.c
)
endif()
2014-07-01 09:36:11 +10:00
include_directories(${PNG_INCLUDE_DIRS})
CMake/macOS: Remove _LIBPATH, avoid link_directories. After tests were bundled in a single executable and cycles and libmv created their own tests, the warnings on macOS have gone over 800. The reason is setting `*_LIBRARIES` to names of the libraries and later using `link_directories` to link them properly. https://cmake.org/cmake/help/latest/command/link_directories.html > Note This command is rarely necessary and should be avoided where > there are other choices. Prefer to pass full absolute paths to > libraries where possible, since this ensures the correct library > will always be linked. The find_library() command provides the > full path, which can generally be used directly in calls to > target_link_libraries(). Warnings like the following popup for every target/executable, for every library it links to. ``` ld: warning: directory not found for option '-L/Users/me/blender-build/blender/../lib/darwin/jpeg/lib/Debug' ``` The patch completes a step towards removing `link_directories` as mentioned in TODO at several places. The patch uses absolute paths to link libraries and removes all `*_LIBPATH`s except `PYTHON_LIBPATH` from `platform_apple.cmake` file. (The corner case where it's used seems like dead code. Python is no longer shipped with that file structure.) Also, unused code for LLVM-3.4 has been removed. Also, guards to avoid searching libraries in system directories have been added. `APPLE` platform now no longer needs `setup_libdirs`, `cycles_link_directories`, and `link_directories`. The number of warnings now is less than 100, most of them being deprecation ones in dependencies. This patch depended on {rBb746179d0add}, {rB2fdbe4d05011}, {rB402a4cadba49} and {rBd7f482f88ecb}. Reviewed By: brecht Differential Revision: https://developer.blender.org/D8855
2020-10-08 19:31:40 +05:30
if(NOT APPLE)
# APPLE plaform uses full paths for linking libraries.
link_directories(${PNG_LIBPATH} ${ZLIB_LIBPATH})
endif()
add_executable(datatoc_icon ${SRC})
setup_platform_linker_flags(datatoc_icon)
2014-01-13 15:46:46 +02:00
target_link_libraries(datatoc_icon ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
# PNG library uses pow() and floow(), so seems -lm is required for proper
# working binary.
if(UNIX AND NOT APPLE)
target_link_libraries(datatoc_icon m)
endif()
endif()