Have package_option automatically generate option library targets instead of checking in every instance they're used.
This commit is contained in:
parent
995688760b
commit
b04ebdda98
|
|
@ -73,9 +73,12 @@ function(package_option name)
|
|||
|
||||
# Create the option.
|
||||
option("HAVE_${name}" "${cache_string}" "${default}")
|
||||
if(NOT HAVE_${name})
|
||||
unset(${name}_LIBRARY)
|
||||
unset(${name}_LIBRARIES)
|
||||
if(HAVE_${name})
|
||||
set(_${name}_LIBRARY ${${name}_LIBRARY} CACHE INTERNAL "<Internal>")
|
||||
set(_${name}_LIBRARIES ${${name}_LIBRARIES} CACHE INTERNAL "<Internal>")
|
||||
else()
|
||||
unset(_${name}_LIBRARY CACHE)
|
||||
unset(_${name}_LIBRARIES CACHE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
|
@ -93,9 +96,9 @@ macro(target_use_packages target)
|
|||
if(HAVE_${lib})
|
||||
target_include_directories("${target}" PUBLIC "${${lib}_INCLUDE_DIRS};${${lib}_INCLUDE_DIR}")
|
||||
if(${lib}_LIBRARIES)
|
||||
target_link_libraries("${target}" ${${lib}_LIBRARIES})
|
||||
target_link_libraries("${target}" ${_${lib}_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries("${target}" ${${lib}_LIBRARY})
|
||||
target_link_libraries("${target}" ${_${lib}_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
endforeach(lib)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ add_definitions(-DBUILDING_DTOOLCONFIG)
|
|||
|
||||
if(HAVE_PYTHON)
|
||||
add_library(p3dtoolconfig dtoolconfig.cxx pydtool.cxx)
|
||||
target_link_libraries(p3dtoolconfig ${PYTHON_LIBRARIES})
|
||||
target_link_libraries(p3dtoolconfig ${_PYTHON_LIBRARIES})
|
||||
else()
|
||||
add_library(p3dtoolconfig dtoolconfig.cxx)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -50,4 +50,4 @@ composite_sources(interrogate INTERROGATE_SOURCES)
|
|||
add_executable(interrogate ${INTERROGATE_HEADERS} ${INTERROGATE_SOURCES})
|
||||
target_link_libraries(interrogate
|
||||
p3cppParser p3interrogatedb p3dconfig p3prc p3dtoolutil p3dtoolbase
|
||||
p3pystub ${OPENSSL_LIBRARIES})
|
||||
p3pystub ${_OPENSSL_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -65,4 +65,4 @@ set(P3PRC_SOURCES
|
|||
composite_sources(p3prc P3PRC_SOURCES)
|
||||
|
||||
add_library(p3prc ${P3PRC_HEADERS} ${P3PRC_SOURCES})
|
||||
target_link_libraries(p3prc p3dtoolutil p3dtoolbase ${OPENSSL_LIBRARIES})
|
||||
target_link_libraries(p3prc p3dtoolutil p3dtoolbase ${_OPENSSL_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -125,9 +125,10 @@ set(P3EXPRESS_SOURCES
|
|||
|
||||
composite_sources(p3express P3EXPRESS_SOURCES)
|
||||
|
||||
message("TAR ${_TAR_LIBRARY}")
|
||||
add_library(p3express ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS})
|
||||
target_link_libraries(p3express p3pandabase p3dtool p3dtoolconfig
|
||||
${TAR_LIBRARY})
|
||||
${_TAR_LIBRARY})
|
||||
target_interrogate(p3express ALL)
|
||||
|
||||
#add_executable(p3expressTestTypes test_types.cxx)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@ if(HAVE_GL)
|
|||
composite_sources(p3glgsg P3GLGSG_SOURCES)
|
||||
add_library(p3glgsg ${P3GLGSG_HEADERS} ${P3GLGSG_SOURCES})
|
||||
target_link_libraries(p3glgsg p3glstuff p3display
|
||||
${OPENGL_LIBRARIES} ${CG_LIBRARIES})
|
||||
${OPENGL_LIBRARIES} ${_CG_LIBRARIES})
|
||||
target_interrogate(p3glgsg ALL)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ set(P3GOBJ_SOURCES
|
|||
composite_sources(p3gobj P3GOBJ_SOURCES)
|
||||
add_library(p3gobj ${P3GOBJ_HEADERS} ${P3GOBJ_SOURCES})
|
||||
target_link_libraries(p3gobj p3gsgbase p3pnmimage
|
||||
${ZLIB_LIBRARIES} ${SQUISH_LIBRARY})
|
||||
${_ZLIB_LIBRARIES} ${_SQUISH_LIBRARY})
|
||||
target_interrogate(p3gobj ALL)
|
||||
|
||||
#begin test_bin_target
|
||||
|
|
|
|||
|
|
@ -26,29 +26,8 @@ set(P3PNMIMAGETYPES_SOURCES
|
|||
pnmFileTypeTGA.cxx
|
||||
)
|
||||
|
||||
# We aggregate the PNMIMAGETYPES libraries depending on which image formats are
|
||||
# compiled in.
|
||||
unset(PNMIMAGETYPES_LINK_LIBRARIES)
|
||||
|
||||
if(HAVE_JPEG)
|
||||
set(PNMIMAGETYPES_LINK_LIBRARIES
|
||||
${PNMIMAGETYPES_LINK_LIBRARIES}
|
||||
${JPEG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(HAVE_TIFF)
|
||||
set(PNMIMAGETYPES_LINK_LIBRARIES
|
||||
${PNMIMAGETYPES_LINK_LIBRARIES}
|
||||
${TIFF_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(HAVE_PNG)
|
||||
set(PNMIMAGETYPES_LINK_LIBRARIES
|
||||
${PNMIMAGETYPES_LINK_LIBRARIES}
|
||||
${PNG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
composite_sources(p3pnmimagetypes P3PNMIMAGETYPES_SOURCES)
|
||||
add_library(p3pnmimagetypes ${P3PNMIMAGETYPES_HEADERS} ${P3PNMIMAGETYPES_SOURCES})
|
||||
target_link_libraries(p3pnmimagetypes p3pnmimage ${PNMIMAGETYPES_LINK_LIBRARIES})
|
||||
target_link_libraries(p3pnmimagetypes p3pnmimage ${_JPEG_LIBRARIES}
|
||||
${_TIFF_LIBRARIES} ${_PNG_LIBRARIES})
|
||||
target_interrogate(p3pnmimagetypes ALL)
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ set(P3PNMTEXT_SOURCES
|
|||
|
||||
composite_sources(p3pnmtext P3PNMTEXT_SOURCES)
|
||||
add_library(p3pnmtext ${P3PNMTEXT_SOURCES} ${P3PNMTEXT_HEADERS})
|
||||
target_link_libraries(p3pnmtext p3pnmimage ${FREETYPE_LIBRARIES})
|
||||
target_link_libraries(p3pnmtext p3pnmimage ${_FREETYPE_LIBRARIES})
|
||||
target_interrogate(p3pnmtext ALL)
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ set(P3TEXT_SOURCES
|
|||
|
||||
composite_sources(p3text P3TEXT_SOURCES)
|
||||
add_library(p3text ${P3TEXT_SOURCES} ${P3TEXT_HEADERS})
|
||||
target_link_libraries(p3text p3pnmtext p3parametrics ${FREETYPE_LIBRARIES})
|
||||
target_link_libraries(p3text p3pnmtext p3parametrics ${_FREETYPE_LIBRARIES})
|
||||
target_interrogate(p3text ALL)
|
||||
|
|
|
|||
Loading…
Reference in New Issue