diff --git a/cmake/macros/PackageConfig.cmake b/cmake/macros/PackageConfig.cmake index dd313685c8..20e408df2d 100644 --- a/cmake/macros/PackageConfig.cmake +++ b/cmake/macros/PackageConfig.cmake @@ -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 "") + set(_${name}_LIBRARIES ${${name}_LIBRARIES} CACHE 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) diff --git a/dtool/metalibs/dtoolconfig/CMakeLists.txt b/dtool/metalibs/dtoolconfig/CMakeLists.txt index a9ed486379..054d2095bc 100644 --- a/dtool/metalibs/dtoolconfig/CMakeLists.txt +++ b/dtool/metalibs/dtoolconfig/CMakeLists.txt @@ -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() diff --git a/dtool/src/interrogate/CMakeLists.txt b/dtool/src/interrogate/CMakeLists.txt index 7444dfbab3..fd28d48ca9 100644 --- a/dtool/src/interrogate/CMakeLists.txt +++ b/dtool/src/interrogate/CMakeLists.txt @@ -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}) diff --git a/dtool/src/prc/CMakeLists.txt b/dtool/src/prc/CMakeLists.txt index e3fc7afac3..57cea800b0 100644 --- a/dtool/src/prc/CMakeLists.txt +++ b/dtool/src/prc/CMakeLists.txt @@ -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}) diff --git a/panda/src/express/CMakeLists.txt b/panda/src/express/CMakeLists.txt index 8f93753e4d..7921b23578 100644 --- a/panda/src/express/CMakeLists.txt +++ b/panda/src/express/CMakeLists.txt @@ -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) diff --git a/panda/src/glgsg/CMakeLists.txt b/panda/src/glgsg/CMakeLists.txt index ba0cb410d1..06645e18e1 100644 --- a/panda/src/glgsg/CMakeLists.txt +++ b/panda/src/glgsg/CMakeLists.txt @@ -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() diff --git a/panda/src/gobj/CMakeLists.txt b/panda/src/gobj/CMakeLists.txt index ef1d2bedd6..117527ba96 100644 --- a/panda/src/gobj/CMakeLists.txt +++ b/panda/src/gobj/CMakeLists.txt @@ -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 diff --git a/panda/src/pnmimagetypes/CMakeLists.txt b/panda/src/pnmimagetypes/CMakeLists.txt index 367531eff1..02f89a3a6d 100644 --- a/panda/src/pnmimagetypes/CMakeLists.txt +++ b/panda/src/pnmimagetypes/CMakeLists.txt @@ -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) diff --git a/panda/src/pnmtext/CMakeLists.txt b/panda/src/pnmtext/CMakeLists.txt index 73e2e67a96..534b9a80e3 100644 --- a/panda/src/pnmtext/CMakeLists.txt +++ b/panda/src/pnmtext/CMakeLists.txt @@ -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) diff --git a/panda/src/text/CMakeLists.txt b/panda/src/text/CMakeLists.txt index cc6e5d1fcb..1815b6e529 100644 --- a/panda/src/text/CMakeLists.txt +++ b/panda/src/text/CMakeLists.txt @@ -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)