Link the executables only agains libcore and librender by default in CMake

metadata
Edgar Velazquez-Armendariz 2013-02-02 09:26:01 -05:00
parent 8c60ffb729
commit 4637821c30
3 changed files with 22 additions and 9 deletions

View File

@ -310,15 +310,15 @@ macro (add_mts_plugin _plugin_name)
add_library (${_plugin_name} MODULE ${_plugin_srcs})
endif ()
set(core_libraries "mitsuba-core" "mitsuba-render")
set(_plugin_core_libraries "mitsuba-core" "mitsuba-render")
if (_plugin_MTS_HW)
list(APPEND core_libraries "mitsuba-hw")
list(APPEND _plugin_core_libraries "mitsuba-hw")
endif()
if (_plugin_MTS_BIDIR)
list(APPEND core_libraries "mitsuba-bidir")
list(APPEND _plugin_core_libraries "mitsuba-bidir")
endif()
target_link_libraries (${_plugin_name}
${core_libraries} ${_plugin_LINK_LIBRARIES})
${_plugin_core_libraries} ${_plugin_LINK_LIBRARIES})
set_target_properties (${_plugin_name} PROPERTIES PREFIX "")
if (APPLE)
@ -369,6 +369,7 @@ endif()
# [RES_ICON filename]
# [RES_DESCRIPTION "Description string"]
# [NO_INSTALL]
# [MTS_HW] [MTS_BIDIR]
# [NO_MTS_PCH | PCH pch_header] )
#
# The executable name is taken from the first argument. The target gets
@ -377,6 +378,11 @@ endif()
# (for example, libpng) may be specified after the optionl LINK_LIBRARIES
# keyword.
#
# By default the executables are linked against mitsuba-core and mitsuba-render.
# When MTS_HW is set, the executable will be linked against with mitsuba-hw.
# When MTS_BIDIR is specified, the executable will also be linked against
# mitsuba-bidir.
#
# The optional keyword WIN32, if presents, gets passed to add_executable(...)
# to produce a Windows executable using winmain, thus it won't have a
# console. The NO_INSTALL keyword causes the target not to be installed.
@ -390,7 +396,7 @@ endif()
# builds; other platforms simply ignore this value as with RES_ICON.
#
macro (add_mts_exe _exe_name)
CMAKE_PARSE_ARGUMENTS(_exe "WIN32;NO_INSTALL;NO_MTS_PCH"
CMAKE_PARSE_ARGUMENTS(_exe "WIN32;NO_INSTALL;MTS_HW;MTS_BIDIR;NO_MTS_PCH"
"PCH;RES_ICON;RES_DESCRIPTION" "LINK_LIBRARIES" ${ARGN})
set (_exe_srcs ${_exe_UNPARSED_ARGUMENTS})
if (_exe_WIN32)
@ -427,8 +433,15 @@ macro (add_mts_exe _exe_name)
else ()
add_executable (${_exe_name} ${_exe_TYPE} ${_exe_srcs})
endif ()
target_link_libraries (${_exe_name}
${MTS_CORELIBS} ${_exe_LINK_LIBRARIES})
set(_exe_core_libraries "mitsuba-core" "mitsuba-render")
if (_exe_MTS_HW)
list(APPEND _exe_core_libraries "mitsuba-hw")
endif()
if (_exe_MTS_BIDIR)
list(APPEND _exe_core_libraries "mitsuba-bidir")
endif()
target_link_libraries (${_exe_name} ${_exe_core_libraries} ${_exe_LINK_LIBRARIES})
if (WIN32)
set_target_properties (${_exe_name} PROPERTIES VERSION "${MTS_VERSION}")
endif()

View File

@ -25,5 +25,5 @@ target_link_libraries(mtsconverter_lib
${COLLADA_LIBRARIES} ${XERCES_LIBRARIES} ${OPENGL_glu_LIBRARY})
add_mts_exe(mtsimport mtsimport.cpp ${SRCS}
${MTS_DARWIN_STUB} ${MTS_WINDOWS_STUB} LINK_LIBRARIES mtsconverter_lib
${MTS_DARWIN_STUB} ${MTS_WINDOWS_STUB} MTS_HW LINK_LIBRARIES mtsconverter_lib
RES_DESCRIPTION "Mitsuba COLLADA 1.4 & Wavefront OBJ importer")

View File

@ -169,7 +169,7 @@ add_mts_exe(mtsgui ${MTS_EXE_TYPE} ${SRCS} ${HDRS}
PCH "${CMAKE_CURRENT_SOURCE_DIR}/pch/mtsgui_precompiled.hpp"
RES_ICON "${PROJECT_SOURCE_DIR}/data/windows/mitsuba.ico"
RES_DESCRIPTION "Mitsuba interactive Qt-based frontend"
LINK_LIBRARIES ${LIBS})
MTS_HW LINK_LIBRARIES ${LIBS})
# Custom targets to copy the bundle files and the PreviewSettings objects