remove TARGET_NAME from cmake macros where it is not required

This commit is contained in:
Stephen Birarda 2014-08-08 12:55:06 -07:00
parent 27419b7b6b
commit b1310c065c
33 changed files with 119 additions and 120 deletions

View file

@ -1,11 +1,11 @@
set(TARGET_NAME assignment-client)
setup_hifi_project(${TARGET_NAME} Core Gui Network Script Widgets)
setup_hifi_project(Core Gui Network Script Widgets)
include_glm(${TARGET_NAME})
include_glm()
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME}
link_hifi_libraries(
audio avatars octree voxels fbx particles models metavoxels
networking animation shared script-engine embedded-webserver
)
@ -14,4 +14,4 @@ if (UNIX)
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK ${CMAKE_DL_LIBS})
endif (UNIX)
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -8,8 +8,8 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(AUTO_MTC TARGET)
set(AUTOMTC_SRC ${TARGET}_automtc.cpp)
macro(AUTO_MTC)
set(AUTOMTC_SRC ${TARGET_NAME}_automtc.cpp)
file(GLOB INCLUDE_FILES src/*.h)

View file

@ -7,7 +7,7 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(INCLUDE_GLM TARGET)
macro(INCLUDE_GLM)
find_package(GLM REQUIRED)
include_directories("${GLM_INCLUDE_DIRS}")
@ -16,4 +16,4 @@ macro(INCLUDE_GLM TARGET)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${GLM_INCLUDE_DIRS}")
endif ()
endmacro(INCLUDE_GLM _target)
endmacro(INCLUDE_GLM)

View file

@ -7,7 +7,7 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(LINK_HIFI_LIBRARIES TARGET)
macro(LINK_HIFI_LIBRARIES)
file(RELATIVE_PATH RELATIVE_LIBRARY_DIR_PATH ${CMAKE_CURRENT_SOURCE_DIR} "${HIFI_LIBRARY_DIR}")
@ -20,15 +20,15 @@ macro(LINK_HIFI_LIBRARIES TARGET)
include_directories("${HIFI_LIBRARY_DIR}/${HIFI_LIBRARY}/src")
add_dependencies(${TARGET} ${HIFI_LIBRARY})
add_dependencies(${TARGET_NAME} ${HIFI_LIBRARY})
# link the actual library - it is static so don't bubble it up
target_link_libraries(${TARGET} ${HIFI_LIBRARY})
target_link_libraries(${TARGET_NAME} ${HIFI_LIBRARY})
# ask the library what its dynamic dependencies are and link them
get_target_property(LINKED_TARGET_DEPENDENCY_LIBRARIES ${HIFI_LIBRARY} DEPENDENCY_LIBRARIES)
list(APPEND ${TARGET}_LIBRARIES_TO_LINK ${LINKED_TARGET_DEPENDENCY_LIBRARIES})
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK ${LINKED_TARGET_DEPENDENCY_LIBRARIES})
endforeach()
endmacro(LINK_HIFI_LIBRARIES _target _libraries)
endmacro(LINK_HIFI_LIBRARIES)

View file

@ -1,5 +1,5 @@
#
# LinkHifiLibrary.cmake
# LinkSharedDependencies.cmake
# cmake/macros
#
# Copyright 2014 High Fidelity, Inc.
@ -9,17 +9,17 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(LINK_SHARED_DEPENDENCIES_TO_TARGET TARGET)
if (${TARGET}_LIBRARIES_TO_LINK)
list(REMOVE_DUPLICATES ${TARGET}_LIBRARIES_TO_LINK)
macro(LINK_SHARED_DEPENDENCIES)
if (${TARGET_NAME}_LIBRARIES_TO_LINK)
list(REMOVE_DUPLICATES ${TARGET_NAME}_LIBRARIES_TO_LINK)
# link these libraries to our target
target_link_libraries(${TARGET} ${${TARGET}_LIBRARIES_TO_LINK})
target_link_libraries(${TARGET_NAME} ${${TARGET_NAME}_LIBRARIES_TO_LINK})
endif ()
# we've already linked our Qt modules, but we need to bubble them up to parents
list(APPEND ${TARGET}_LIBRARIES_TO_LINK "${${TARGET}_QT_MODULES_TO_LINK}")
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${${TARGET}_QT_MODULES_TO_LINK}")
# set the property on this target so it can be retreived by targets linking to us
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${${TARGET}_LIBRARIES_TO_LINK}")
endmacro(LINK_SHARED_DEPENDENCIES_TO_TARGET _target)
endmacro(LINK_SHARED_DEPENDENCIES)

View file

@ -7,16 +7,16 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(SETUP_HIFI_LIBRARY TARGET)
macro(SETUP_HIFI_LIBRARY)
project(${TARGET})
project(${TARGET_NAME})
# grab the implemenation and header files
file(GLOB LIB_SRCS src/*.h src/*.cpp)
set(LIB_SRCS ${LIB_SRCS})
# create a library and set the property so it can be referenced later
add_library(${TARGET} ${LIB_SRCS} ${AUTOMTC_SRC})
add_library(${TARGET_NAME} ${LIB_SRCS} ${AUTOMTC_SRC})
set(QT_MODULES_TO_LINK ${ARGN})
list(APPEND QT_MODULES_TO_LINK Core)
@ -27,7 +27,7 @@ macro(SETUP_HIFI_LIBRARY TARGET)
get_target_property(QT_LIBRARY_LOCATION Qt5::${QT_MODULE} LOCATION)
# add the actual path to the Qt module to our LIBRARIES_TO_LINK variable
target_link_libraries(${TARGET} Qt5::${QT_MODULE})
list(APPEND ${TARGET}_QT_MODULES_TO_LINK ${QT_LIBRARY_LOCATION})
target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE})
list(APPEND ${TARGET_NAME}_QT_MODULES_TO_LINK ${QT_LIBRARY_LOCATION})
endforeach()
endmacro(SETUP_HIFI_LIBRARY _target)
endmacro(SETUP_HIFI_LIBRARY)

View file

@ -7,8 +7,8 @@
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(SETUP_HIFI_PROJECT TARGET)
project(${TARGET})
macro(SETUP_HIFI_PROJECT)
project(${TARGET_NAME})
# grab the implemenation and header files
file(GLOB TARGET_SRCS src/*)
@ -23,7 +23,7 @@ macro(SETUP_HIFI_PROJECT TARGET)
endforeach()
# add the executable, include additional optional sources
add_executable(${TARGET} ${TARGET_SRCS} "${AUTOMTC_SRC}")
add_executable(${TARGET_NAME} ${TARGET_SRCS} "${AUTOMTC_SRC}")
set(QT_MODULES_TO_LINK ${ARGN})
list(APPEND QT_MODULES_TO_LINK Core)
@ -31,11 +31,11 @@ macro(SETUP_HIFI_PROJECT TARGET)
find_package(Qt5 COMPONENTS ${QT_MODULES_TO_LINK})
foreach(QT_MODULE ${QT_MODULES_TO_LINK})
target_link_libraries(${TARGET} Qt5::${QT_MODULE})
target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE})
# add the actual path to the Qt module to our LIBRARIES_TO_LINK variable
get_target_property(QT_LIBRARY_LOCATION Qt5::${QT_MODULE} LOCATION)
list(APPEND ${TARGET}_QT_MODULES_TO_LINK ${QT_LIBRARY_LOCATION})
list(APPEND ${TARGET_NAME}_QT_MODULES_TO_LINK ${QT_LIBRARY_LOCATION})
endforeach()
endmacro()

View file

@ -1,7 +1,7 @@
set(TARGET_NAME domain-server)
# setup the project and link required Qt modules
setup_hifi_project(${TARGET_NAME} Network)
setup_hifi_project(Network)
# remove and then copy the files for the webserver
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
@ -13,7 +13,7 @@ add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/web)
# link the shared hifi libraries
link_hifi_libraries(${TARGET_NAME} embedded-webserver networking shared)
link_hifi_libraries(embedded-webserver networking shared)
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -32,7 +32,7 @@ elseif (WIN32)
endif ()
# set up the external glm library
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
# create the InterfaceConfig.h file based on GL_HEADERS above
configure_file(InterfaceConfig.h.in "${PROJECT_BINARY_DIR}/includes/InterfaceConfig.h")
@ -91,7 +91,7 @@ endif()
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
# link required hifi libraries
link_hifi_libraries(${TARGET_NAME} shared octree voxels fbx metavoxels networking particles models avatars audio animation script-engine)
link_hifi_libraries(shared octree voxels fbx metavoxels networking particles models avatars audio animation script-engine)
# find any optional and required libraries
find_package(Faceplus)
@ -211,4 +211,4 @@ else (APPLE)
endif (APPLE)
# link any dependencies bubbled up from our linked dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,9 +1,9 @@
set(TARGET_NAME animation)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Script)
setup_hifi_library(Network Script)
link_hifi_libraries(${TARGET_NAME} shared fbx)
link_hifi_libraries(shared fbx)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME audio)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network)
setup_hifi_library(Network)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
link_hifi_libraries(${TARGET_NAME} networking shared)
link_hifi_libraries(networking shared)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,12 +1,12 @@
set(TARGET_NAME avatars)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Script)
setup_hifi_library(Network Script)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
link_hifi_libraries(${TARGET_NAME} shared octree voxels networking)
link_hifi_libraries(shared octree voxels networking)
include_hifi_library_headers(fbx)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,7 +1,7 @@
set(TARGET_NAME embedded-webserver)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network)
setup_hifi_library(Network)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,15 +1,15 @@
set(TARGET_NAME fbx)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME})
setup_hifi_library()
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm("${ROOT_DIR}")
link_hifi_libraries(${TARGET_NAME} shared networking octree voxels)
link_hifi_libraries(shared networking octree voxels)
find_package(ZLIB)
include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${ZLIB_LIBRARIES}")
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,14 +1,14 @@
set(TARGET_NAME metavoxels)
auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
auto_mtc()
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Script Widgets)
setup_hifi_library(Network Script Widgets)
# link in the networking library
link_hifi_libraries(${TARGET_NAME} shared networking)
link_hifi_libraries(shared networking)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME models)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Script)
setup_hifi_library(Network Script)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
link_hifi_libraries(${TARGET_NAME} shared octree fbx networking animation)
link_hifi_libraries(shared octree fbx networking animation)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,9 +1,9 @@
set(TARGET_NAME networking)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network)
setup_hifi_library(Network)
link_hifi_libraries(${TARGET_NAME} shared)
link_hifi_libraries(shared)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME octree)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME})
setup_hifi_library()
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
link_hifi_libraries(${TARGET_NAME} shared networking)
link_hifi_libraries(shared networking)
# find ZLIB and OpenSSL
find_package(ZLIB)
@ -18,4 +18,4 @@ list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${ZLIB_LIBRARIES}")
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${OPENSSL_LIBRARIES}")
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,12 +1,12 @@
set(TARGET_NAME particles)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Gui Network Script)
setup_hifi_library(Gui Network Script)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
link_hifi_libraries(${TARGET_NAME} shared octree fbx networking animation)
link_hifi_libraries(shared octree fbx networking animation)
include_hifi_library_headers(script-engine)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME script-engine)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Gui Network Script Widgets)
setup_hifi_library(Gui Network Script Widgets)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
link_hifi_libraries(${TARGET_NAME} shared octree voxels fbx particles models animation)
link_hifi_libraries(shared octree voxels fbx particles models animation)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,7 +1,7 @@
set(TARGET_NAME shared)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Network Widgets)
setup_hifi_library(Network Widgets)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME voxels)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(${TARGET_NAME} Widgets Script)
setup_hifi_library(Widgets Script)
include_glm(${TARGET_NAME} "${ROOT_DIR}")
include_glm()
link_hifi_libraries(${TARGET_NAME} shared octree networking)
link_hifi_libraries(shared octree networking)
# find ZLIB
find_package(ZLIB)
@ -15,4 +15,4 @@ include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
list(APPEND ${TARGET}_LIBRARIES_TO_LINK "${ZLIB_LIBRARIES}")
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,12 +1,11 @@
set(TARGET_NAME audio-tests)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
#include glm
include_glm(${TARGET_NAME} ${ROOT_DIR})
include_glm()
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME} shared audio networking)
link_hifi_libraries(shared audio networking)
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,9 +1,9 @@
set(TARGET_NAME jitter-tests)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME} shared networking)
link_hifi_libraries(shared networking)
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,13 +1,13 @@
set(TARGET_NAME metavoxel-tests)
auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
auto_mtc()
include_glm(${TARGET_NAME})
include_glm()
setup_hifi_project(${TARGET_NAME} Network Script Widgets)
setup_hifi_project(Network Script Widgets)
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME} metavoxels networking shared)
link_hifi_libraries(metavoxels networking shared)
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,9 +1,9 @@
set(TARGET_NAME networking-tests)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME} shared networking)
link_hifi_libraries(shared networking)
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME octree-tests)
setup_hifi_project(${TARGET_NAME} Script Network)
setup_hifi_project(Script Network)
include_glm(${TARGET_NAME})
include_glm()
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME} animation fbx models networking octree shared)
link_hifi_libraries(animation fbx models networking octree shared)
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME physics-tests)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
include_glm(${TARGET_NAME})
include_glm()
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME} shared)
link_hifi_libraries(shared)
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,11 +1,11 @@
set(TARGET_NAME shared-tests)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
include_glm(${TARGET_NAME})
include_glm()
# link in the shared libraries
link_hifi_libraries(${TARGET_NAME} shared)
link_hifi_libraries(shared)
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,5 +1,5 @@
set(TARGET_NAME bitstream2json)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,5 +1,5 @@
set(TARGET_NAME json2bitstream)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,5 +1,5 @@
set(TARGET_NAME mtc)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()

View file

@ -1,6 +1,6 @@
set(TARGET_NAME voxel-edit)
setup_hifi_project(${TARGET_NAME})
setup_hifi_project()
# link any shared dependencies
link_shared_dependencies_to_target(${TARGET_NAME})
link_shared_dependencies()