diff --git a/build-support/custom-modules/ns3-module-macros.cmake b/build-support/custom-modules/ns3-module-macros.cmake index 8dd9d10a1..4efa2a741 100644 --- a/build-support/custom-modules/ns3-module-macros.cmake +++ b/build-support/custom-modules/ns3-module-macros.cmake @@ -110,9 +110,7 @@ function(build_lib) endif() # Split ns and non-ns libraries to manage their propagation properly - set(non_ns_libraries_to_link - ${CMAKE_THREAD_LIBS_INIT} - ) + set(non_ns_libraries_to_link ${CMAKE_THREAD_LIBS_INIT}) set(ns_libraries_to_link) diff --git a/build-support/macros-and-definitions.cmake b/build-support/macros-and-definitions.cmake index 074d0bae7..34b577785 100644 --- a/build-support/macros-and-definitions.cmake +++ b/build-support/macros-and-definitions.cmake @@ -536,6 +536,9 @@ macro(process_options) if(${SQLite3_FOUND}) set(ENABLE_SQLITE True) + add_definitions(-DHAVE_SQLITE3) + include_directories(${SQLite3_INCLUDE_DIRS}) + link_libraries(${SQLite3_LIBRARIES}) else() message(${HIGHLIGHTED_STATUS} "SQLite was not found") endif() @@ -635,6 +638,11 @@ macro(process_options) ) else() message(STATUS "GTK3 was found.") + if(${GCC}) + add_definitions(-Wno-parentheses) + endif() + include_directories(${GTK3_INCLUDE_DIRS} ${HarfBuzz_INCLUDE_DIRS}) + link_libraries(${GTK3_LIBRARIES}) endif() endif() @@ -660,6 +668,8 @@ macro(process_options) else() message(STATUS "LibXML2 was found.") add_definitions(-DHAVE_LIBXML2) + include_directories(${LIBXML2_INCLUDE_DIR}) + link_libraries(${LIBXML2_LIBRARIES}) endif() # LibRT @@ -678,6 +688,7 @@ macro(process_options) message(STATUS "LibRT was found.") set(ENABLE_REALTIME TRUE) set(HAVE_RT TRUE) # for core-config.h + link_libraries(${LIBRT_LIBRARIES}) endif() endif() endif() @@ -735,6 +746,8 @@ macro(process_options) set(CMAKE_INSTALL_RPATH "${DEVELOPER_DIR}" CACHE STRING "") endif() endif() + include_directories(${Python3_INCLUDE_DIRS}) + link_libraries(${Python3_LIBRARIES}) else() message(${HIGHLIGHTED_STATUS} "Python: development libraries were not found" @@ -863,6 +876,8 @@ macro(process_options) else() message(STATUS "MPI was found.") add_definitions(-DNS3_MPI) + include_directories(${MPI_CXX_INCLUDE_DIRS}) + link_libraries(${MPI_CXX_LIBRARIES}) set(ENABLE_MPI TRUE) endif() endif() @@ -891,6 +906,8 @@ macro(process_options) else() message(STATUS "GSL was found.") add_definitions(-DHAVE_GSL) + include_directories(${GSL_INCLUDE_DIRS}) + link_libraries(${GSL_LIBRARIES}) endif() endif() @@ -2079,6 +2096,7 @@ endfunction() function(get_target_includes target output) set(include_directories) get_target_property(include_dirs ${target} INCLUDE_DIRECTORIES) + list(REMOVE_DUPLICATES include_dirs) foreach(include_dir ${include_dirs}) if(include_dir MATCHES "<") # Skip CMake build and install interface includes diff --git a/examples/stats/wifi-example-sim.cc b/examples/stats/wifi-example-sim.cc index 751e2ca2f..0b6dd94fa 100644 --- a/examples/stats/wifi-example-sim.cc +++ b/examples/stats/wifi-example-sim.cc @@ -94,7 +94,7 @@ int main (int argc, char *argv[]) { return -1; } - #ifndef STATS_HAS_SQLITE3 + #ifndef HAVE_SQLITE3 if (format == "db") { NS_LOG_ERROR ("sqlite support not compiled in."); return -1; @@ -300,7 +300,7 @@ int main (int argc, char *argv[]) { NS_LOG_INFO ("Creating omnet formatted data output."); output = CreateObject(); } else if (format == "db") { - #ifdef STATS_HAS_SQLITE3 + #ifdef HAVE_SQLITE3 NS_LOG_INFO ("Creating sqlite formatted data output."); output = CreateObject(); #endif diff --git a/src/brite/examples/CMakeLists.txt b/src/brite/examples/CMakeLists.txt index 50641aed3..5ac00d54b 100644 --- a/src/brite/examples/CMakeLists.txt +++ b/src/brite/examples/CMakeLists.txt @@ -20,10 +20,5 @@ if(${ENABLE_MPI}) ${libnix-vector-routing} ${libapplications} ${libmpi} - ${MPI_CXX_LIBRARIES} - ) - target_include_directories( - brite-MPI-example - PUBLIC ${MPI_CXX_INCLUDE_DIRS} ) endif() diff --git a/src/config-store/CMakeLists.txt b/src/config-store/CMakeLists.txt index 2adbacfac..a271264b7 100644 --- a/src/config-store/CMakeLists.txt +++ b/src/config-store/CMakeLists.txt @@ -9,26 +9,12 @@ if(${GTK3_FOUND}) set(gtk3_headers model/gtk-config-store.h ) - include_directories( - ${GTK3_INCLUDE_DIRS} - ${HarfBuzz_INCLUDE_DIRS} - ) - set(gtk_libraries - ${GTK3_LIBRARIES} - ) - if(${GCC}) - add_definitions(-Wno-parentheses) - endif() endif() if(${LIBXML2_FOUND}) set(xml2_sources model/xml-config.cc ) - set(xml2_libraries - ${LIBXML2_LIBRARIES} - ) - include_directories(${LIBXML2_INCLUDE_DIR}) endif() build_lib( @@ -45,9 +31,6 @@ build_lib( ${gtk3_headers} model/file-config.h model/config-store.h - LIBRARIES_TO_LINK - ${libcore} - ${libnetwork} - ${xml2_libraries} - ${gtk_libraries} + LIBRARIES_TO_LINK ${libcore} + ${libnetwork} ) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a96927364..23f160abf 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -3,11 +3,6 @@ set(libraries_to_link) set(gsl_test_sources) if(${GSL_FOUND}) - include_directories(${GSL_INCLUDE_DIRS}) - set(libraries_to_link - ${libraries_to_link} - ${GSL_LIBRARIES} - ) set(gsl_test_sources test/rng-test-suite.cc test/random-variable-stream-test-suite.cc @@ -74,13 +69,8 @@ if(${ENABLE_REALTIME}) model/realtime-simulator-impl.h model/wall-clock-synchronizer.h ) - set(libraries_to_link - ${libraries_to_link} - ${LIBRT} - ) endif() -set(osclock_sources) set(osclock_sources model/unix-system-wall-clock-ms.cc ) diff --git a/src/mpi/CMakeLists.txt b/src/mpi/CMakeLists.txt index 42535a9af..cc5ddb158 100644 --- a/src/mpi/CMakeLists.txt +++ b/src/mpi/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(${MPI_CXX_INCLUDE_DIRS}) - set(example_as_test_suite) if(${ENABLE_EXAMPLES}) set(example_as_test_suite @@ -23,9 +21,7 @@ build_lib( model/mpi-interface.h model/mpi-receiver.h model/parallel-communication-interface.h - LIBRARIES_TO_LINK - ${libcore} - ${libnetwork} - ${MPI_CXX_LIBRARIES} + LIBRARIES_TO_LINK ${libcore} + ${libnetwork} TEST_SOURCES ${example_as_test_suite} ) diff --git a/src/mpi/examples/CMakeLists.txt b/src/mpi/examples/CMakeLists.txt index c05b223f2..70c2e21b4 100644 --- a/src/mpi/examples/CMakeLists.txt +++ b/src/mpi/examples/CMakeLists.txt @@ -1,6 +1,3 @@ -include_directories(${MPI_CXX_INCLUDE_DIRS}) -link_libraries(${MPI_CXX_LIBRARIES}) - set(base_examples simple-distributed simple-distributed-mpi-comm diff --git a/src/point-to-point/CMakeLists.txt b/src/point-to-point/CMakeLists.txt index 59a0af154..2c2871db7 100644 --- a/src/point-to-point/CMakeLists.txt +++ b/src/point-to-point/CMakeLists.txt @@ -11,9 +11,7 @@ if(${ENABLE_MPI}) ) set(mpi_libraries ${libmpi} - ${MPI_CXX_LIBRARIES} ) - include_directories(${MPI_CXX_INCLUDE_DIRS}) endif() build_lib( diff --git a/src/stats/CMakeLists.txt b/src/stats/CMakeLists.txt index e937b2415..c6dd1477a 100644 --- a/src/stats/CMakeLists.txt +++ b/src/stats/CMakeLists.txt @@ -1,6 +1,5 @@ set(sqlite_sources) set(sqlite_header) -set(sqlite_libraries) if(${ENABLE_SQLITE}) set(sqlite_sources model/sqlite-data-output.cc @@ -10,10 +9,6 @@ if(${ENABLE_SQLITE}) model/sqlite-data-output.h model/sqlite-output.h ) - include_directories(${SQLite3_INCLUDE_DIRS}) - set(sqlite_libraries - ${SQLite3_LIBRARIES} - ) endif() set(source_files @@ -74,7 +69,6 @@ build_lib( SOURCE_FILES ${source_files} HEADER_FILES ${header_files} LIBRARIES_TO_LINK ${libcore} - ${sqlite_libraries} TEST_SOURCES test/average-test-suite.cc test/basic-data-calculators-test-suite.cc diff --git a/src/visualizer/CMakeLists.txt b/src/visualizer/CMakeLists.txt index 4237021da..0330bf85c 100644 --- a/src/visualizer/CMakeLists.txt +++ b/src/visualizer/CMakeLists.txt @@ -1,12 +1,9 @@ -include_directories(${Python3_INCLUDE_DIRS}) - build_lib( LIBNAME visualizer SOURCE_FILES model/pyviz.cc model/visual-simulator-impl.cc HEADER_FILES model/pyviz.h LIBRARIES_TO_LINK - ${Python3_LIBRARIES} ${libcore} ${libinternet} ${libwifi} diff --git a/src/wifi/CMakeLists.txt b/src/wifi/CMakeLists.txt index 3136d7136..ec5d5e9ed 100644 --- a/src/wifi/CMakeLists.txt +++ b/src/wifi/CMakeLists.txt @@ -1,11 +1,3 @@ -set(gsl_libraries) -if(${GSL_FOUND}) - include_directories(${GSL_INCLUDE_DIRS}) - set(gsl_libraries - ${GSL_LIBRARIES} - ) -endif() - set(source_files helper/athstats-helper.cc helper/spectrum-wifi-helper.cc @@ -291,7 +283,6 @@ build_lib( ${libspectrum} ${libantenna} ${libmobility} - ${gsl_libraries} TEST_SOURCES test/block-ack-test-suite.cc test/channel-access-manager-test.cc