From: TimePath Date: Sat, 20 Feb 2016 06:32:51 +0000 (+1100) Subject: target_link_libraries X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5c127d0fb568fe5e298dcaefe2a07ed49fa2b304;p=xonotic%2Fnetradiant.git target_link_libraries --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 59ea517e..bed416a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,9 @@ endif () configure_file("${CMAKE_SOURCE_DIR}/include/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp") +add_library(version "${CMAKE_BINARY_DIR}/version.cpp") +set_property(TARGET version PROPERTY POSITION_INDEPENDENT_CODE TRUE) + set(RADIANT_ABOUTMSG "Custom build" CACHE STRING "About message") message(STATUS "Building ${PROJECT_NAME} ${RADIANT_VERSION_STRING} ${RADIANT_ABOUTMSG}") diff --git a/appveyor.yml b/appveyor.yml index dab50ed2..d456c696 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,5 +24,5 @@ build_script: mkdir build && cd build cmake --version cmake -G 'MSYS Makefiles' .. -DGTK2_GLIBCONFIG_INCLUDE_DIR=/mingw64/lib/glib-2.0/include -DGTK2_GDKCONFIG_INCLUDE_DIR=/mingw64/lib/gtk-2.0/include - cmake --build . --target radiant + cmake --build . "@ diff --git a/contrib/bobtoolz/CMakeLists.txt b/contrib/bobtoolz/CMakeLists.txt index b47fdd87..4fd20e38 100644 --- a/contrib/bobtoolz/CMakeLists.txt +++ b/contrib/bobtoolz/CMakeLists.txt @@ -41,7 +41,8 @@ radiant_plugin(bobtoolz visfind.cpp visfind.h ) -find_package(GTK2 REQUIRED) -target_include_directories(bobtoolz PRIVATE ${GTK2_INCLUDE_DIRS}) +target_include_directories(bobtoolz PRIVATE uilib) +target_link_libraries(bobtoolz PRIVATE uilib) -target_link_libraries(bobtoolz mathlib) +target_include_directories(bobtoolz PRIVATE mathlib) +target_link_libraries(bobtoolz PRIVATE mathlib) diff --git a/contrib/brushexport/CMakeLists.txt b/contrib/brushexport/CMakeLists.txt index 19c60d82..578588d4 100644 --- a/contrib/brushexport/CMakeLists.txt +++ b/contrib/brushexport/CMakeLists.txt @@ -6,5 +6,5 @@ radiant_plugin(brushexport support.cpp support.h ) -find_package(GTK2 REQUIRED) -target_include_directories(brushexport PRIVATE ${GTK2_INCLUDE_DIRS}) +target_include_directories(brushexport PRIVATE uilib) +target_link_libraries(brushexport PRIVATE uilib) diff --git a/contrib/prtview/CMakeLists.txt b/contrib/prtview/CMakeLists.txt index 344051f5..d7cf65d5 100644 --- a/contrib/prtview/CMakeLists.txt +++ b/contrib/prtview/CMakeLists.txt @@ -6,5 +6,11 @@ radiant_plugin(prtview prtview.cpp prtview.h ) -find_package(GTK2 REQUIRED) -target_include_directories(prtview PRIVATE ${GTK2_INCLUDE_DIRS}) +target_include_directories(prtview PRIVATE version) +target_link_libraries(prtview PRIVATE version) + +target_include_directories(prtview PRIVATE uilib) +target_link_libraries(prtview PRIVATE uilib) + +target_include_directories(prtview PRIVATE profile) +target_link_libraries(prtview PRIVATE profile) diff --git a/contrib/shaderplug/CMakeLists.txt b/contrib/shaderplug/CMakeLists.txt index 7fca280f..08ccddc5 100644 --- a/contrib/shaderplug/CMakeLists.txt +++ b/contrib/shaderplug/CMakeLists.txt @@ -2,8 +2,8 @@ radiant_plugin(shaderplug shaderplug.cpp shaderplug.h ) -find_package(LibXml2 REQUIRED) -target_include_directories(shaderplug PRIVATE ${LIBXML2_INCLUDE_DIR}) +target_include_directories(shaderplug PRIVATE xmllib) +target_link_libraries(shaderplug PRIVATE xmllib) -find_package(GTK2 REQUIRED) -target_include_directories(shaderplug PRIVATE ${GTK2_INCLUDE_DIRS}) +target_include_directories(shaderplug PRIVATE uilib) +target_link_libraries(shaderplug PRIVATE uilib) diff --git a/contrib/sunplug/CMakeLists.txt b/contrib/sunplug/CMakeLists.txt index 3a2b36f0..9def1819 100644 --- a/contrib/sunplug/CMakeLists.txt +++ b/contrib/sunplug/CMakeLists.txt @@ -2,5 +2,5 @@ radiant_plugin(sunplug sunplug.cpp sunplug.h ) -find_package(GTK2 REQUIRED) -target_include_directories(sunplug PRIVATE ${GTK2_INCLUDE_DIRS}) +target_include_directories(sunplug PRIVATE uilib) +target_link_libraries(sunplug PRIVATE uilib) diff --git a/contrib/ufoaiplug/CMakeLists.txt b/contrib/ufoaiplug/CMakeLists.txt index a72db29e..5c96fdb1 100644 --- a/contrib/ufoaiplug/CMakeLists.txt +++ b/contrib/ufoaiplug/CMakeLists.txt @@ -5,5 +5,8 @@ radiant_plugin(ufoaiplug ufoai_level.cpp ufoai_level.h ) -find_package(GTK2 REQUIRED) -target_include_directories(ufoaiplug PRIVATE ${GTK2_INCLUDE_DIRS}) +target_include_directories(ufoaiplug PRIVATE version) +target_link_libraries(ufoaiplug PRIVATE version) + +target_include_directories(ufoaiplug PRIVATE uilib) +target_link_libraries(ufoaiplug PRIVATE uilib) diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index c5434fc8..d4636270 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -63,3 +63,4 @@ add_library(libs find_package(GLIB REQUIRED) target_include_directories(libs PRIVATE ${GLIB_INCLUDE_DIRS}) +target_link_libraries(libs PRIVATE ${GLIB_LIBRARIES}) diff --git a/libs/gtkutil/CMakeLists.txt b/libs/gtkutil/CMakeLists.txt index 4032653d..f01cf29c 100644 --- a/libs/gtkutil/CMakeLists.txt +++ b/libs/gtkutil/CMakeLists.txt @@ -24,8 +24,12 @@ add_library(gtkutil xorrectangle.h ) -find_package(GTK2 REQUIRED) -target_include_directories(gtkutil PRIVATE ${GTK2_INCLUDE_DIRS} ${GTK2_GDK_INCLUDE_DIR} ${GTK2_GLIB_INCLUDE_DIR}) +target_include_directories(gtkutil PRIVATE uilib) +target_link_libraries(gtkutil PRIVATE uilib) + +target_include_directories(gtkutil PRIVATE ${GTK2_PANGO_INCLUDE_DIR}) +target_link_libraries(gtkutil PRIVATE ${GTK2_PANGO_LIBRARY}) find_package(GtkGLExt REQUIRED) target_include_directories(gtkutil PRIVATE ${GTKGL_INCLUDE_DIRS}) +target_link_libraries(gtkutil PRIVATE ${GTKGL_LIBRARIES}) diff --git a/libs/l_net/CMakeLists.txt b/libs/l_net/CMakeLists.txt index f71111a8..a0a19a84 100644 --- a/libs/l_net/CMakeLists.txt +++ b/libs/l_net/CMakeLists.txt @@ -10,5 +10,5 @@ endif () add_library(l_net ${L_NETLIST}) if (WIN32) - target_link_libraries(l_net ws2_32) + target_link_libraries(l_net PRIVATE ws2_32) endif () diff --git a/libs/os/CMakeLists.txt b/libs/os/CMakeLists.txt index cba5ec01..437b506c 100644 --- a/libs/os/CMakeLists.txt +++ b/libs/os/CMakeLists.txt @@ -7,3 +7,4 @@ add_library(os find_package(GLIB REQUIRED) target_include_directories(os PRIVATE ${GLIB_INCLUDE_DIRS}) +target_link_libraries(os PRIVATE ${GLIB_LIBRARIES}) diff --git a/libs/uilib/CMakeLists.txt b/libs/uilib/CMakeLists.txt index 4950c1e2..fd9c938d 100644 --- a/libs/uilib/CMakeLists.txt +++ b/libs/uilib/CMakeLists.txt @@ -3,4 +3,8 @@ add_library(uilib ) find_package(GTK2 REQUIRED) -target_include_directories(uilib PRIVATE ${GTK2_INCLUDE_DIRS}) +target_include_directories(uilib PUBLIC ${GTK2_INCLUDE_DIRS}) +target_link_libraries(uilib PUBLIC ${GTK2_LIBRARIES}) + +target_include_directories(uilib PUBLIC gtkutil) +target_link_libraries(uilib PUBLIC gtkutil) diff --git a/libs/xml/CMakeLists.txt b/libs/xml/CMakeLists.txt index 4fb6606a..96e1e216 100644 --- a/libs/xml/CMakeLists.txt +++ b/libs/xml/CMakeLists.txt @@ -8,7 +8,8 @@ add_library(xmllib find_package(GLIB REQUIRED) target_include_directories(xmllib PUBLIC ${GLIB_INCLUDE_DIRS}) +target_link_libraries(xmllib PUBLIC ${GLIB_LIBRARIES}) find_package(LibXml2 REQUIRED) target_include_directories(xmllib PUBLIC ${LIBXML2_INCLUDE_DIR}) -target_link_libraries(xmllib ${LIBXML2_LIBRARIES}) +target_link_libraries(xmllib PUBLIC ${LIBXML2_LIBRARIES}) diff --git a/plugins/archivezip/CMakeLists.txt b/plugins/archivezip/CMakeLists.txt index 026b1aa7..7ed025d8 100644 --- a/plugins/archivezip/CMakeLists.txt +++ b/plugins/archivezip/CMakeLists.txt @@ -7,3 +7,4 @@ radiant_plugin(archivezip find_package(ZLIB REQUIRED) target_include_directories(archivezip PRIVATE ${ZLIB_INCLUDE_DIRS}) +target_link_libraries(archivezip PRIVATE ${ZLIB_LIBRARIES}) diff --git a/plugins/image/CMakeLists.txt b/plugins/image/CMakeLists.txt index b5114d9f..e1f40cc5 100644 --- a/plugins/image/CMakeLists.txt +++ b/plugins/image/CMakeLists.txt @@ -10,4 +10,4 @@ radiant_plugin(image find_package(JPEG REQUIRED) target_include_directories(image PRIVATE ${JPEG_INCLUDE_DIR}) -target_link_libraries(image ddslib etclib ${JPEG_LIBRARIES}) +target_link_libraries(image PRIVATE ddslib etclib ${JPEG_LIBRARIES}) diff --git a/plugins/imagepng/CMakeLists.txt b/plugins/imagepng/CMakeLists.txt index 45da9433..a9c69931 100644 --- a/plugins/imagepng/CMakeLists.txt +++ b/plugins/imagepng/CMakeLists.txt @@ -4,3 +4,4 @@ radiant_plugin(imagepng find_package(PNG REQUIRED) target_include_directories(imagepng PRIVATE ${PNG_INCLUDE_DIR}) +target_link_libraries(imagepng PRIVATE ${PNG_LIBRARIES}) diff --git a/plugins/mapxml/CMakeLists.txt b/plugins/mapxml/CMakeLists.txt index 800e31fc..a6aae15f 100644 --- a/plugins/mapxml/CMakeLists.txt +++ b/plugins/mapxml/CMakeLists.txt @@ -4,4 +4,5 @@ radiant_plugin(mapxml xmlwrite.cpp xmlwrite.h ) -target_link_libraries(mapxml xmllib) +target_include_directories(mapxml PRIVATE xmllib) +target_link_libraries(mapxml PRIVATE xmllib) diff --git a/plugins/model/CMakeLists.txt b/plugins/model/CMakeLists.txt index bf55e1ff..4a23e28d 100644 --- a/plugins/model/CMakeLists.txt +++ b/plugins/model/CMakeLists.txt @@ -3,4 +3,5 @@ radiant_plugin(model plugin.cpp ) -target_link_libraries(model picomodel) +target_include_directories(model PRIVATE picomodel) +target_link_libraries(model PRIVATE picomodel) diff --git a/plugins/shaders/CMakeLists.txt b/plugins/shaders/CMakeLists.txt index 9c4b38cc..b565c0ac 100644 --- a/plugins/shaders/CMakeLists.txt +++ b/plugins/shaders/CMakeLists.txt @@ -5,3 +5,4 @@ radiant_plugin(shaders find_package(GLIB REQUIRED) target_include_directories(shaders PRIVATE ${GLIB_INCLUDE_DIRS}) +target_link_libraries(shaders PRIVATE ${GLIB_LIBRARIES}) diff --git a/plugins/vfspk3/CMakeLists.txt b/plugins/vfspk3/CMakeLists.txt index 5591c598..a55e9de0 100644 --- a/plugins/vfspk3/CMakeLists.txt +++ b/plugins/vfspk3/CMakeLists.txt @@ -6,5 +6,7 @@ radiant_plugin(vfspk3 find_package(GLIB REQUIRED) target_include_directories(vfspk3 PRIVATE ${GLIB_INCLUDE_DIRS}) +target_link_libraries(vfspk3 PRIVATE ${GLIB_LIBRARIES}) -target_link_libraries(vfspk3 filematch) +target_include_directories(vfspk3 PRIVATE filematch) +target_link_libraries(vfspk3 PRIVATE filematch) diff --git a/radiant/CMakeLists.txt b/radiant/CMakeLists.txt index b0032207..8b704e7b 100644 --- a/radiant/CMakeLists.txt +++ b/radiant/CMakeLists.txt @@ -1,16 +1,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") -find_package(LibXml2 REQUIRED) -include_directories(${LIBXML2_INCLUDE_DIR}) - -find_package(GTK2 REQUIRED) -include_directories(${GTK2_INCLUDE_DIRS} ${GTK2_GDK_INCLUDE_DIR} ${GTK2_GLIB_INCLUDE_DIR}) - find_package(OpenGL REQUIRED) -find_package(GtkGLExt REQUIRED) -include_directories(${GTKGL_INCLUDE_DIRS}) - include_directories("${CMAKE_SOURCE_DIR}/libs") include_directories("${CMAKE_SOURCE_DIR}/include") @@ -180,7 +171,6 @@ set(RADIANTLIST xmlstuff.h xywindow.cpp xywindow.h - "${CMAKE_BINARY_DIR}/version.cpp" ) add_executable(radiant WIN32 radiant.rc ${RADIANTLIST}) @@ -188,9 +178,8 @@ target_link_libraries(radiant ${CMAKE_DL_LIBS} ${LIBXML2_LIBRARIES} ${OPENGL_gl_LIBRARY} - ${GTK2_LIBRARIES} - ${GTK2_PANGO_LIBRARY} ${GTKGL_LIBRARIES} + version includes cmdlib container @@ -199,7 +188,6 @@ target_link_libraries(radiant etclib filematch generic - gtkutil l_net math mathlib