CMake error

45 views
Skip to first unread message

Peter Barnes

unread,
Jun 23, 2025, 8:35:02 PM6/23/25
to ns-3-users
Hello Folks,

I'm trying to update an old contrib module to the latest ns-3.  My first step is to get it building again in its old state, but on a new machine/environment.

The ns-3 repo I have to start from is based on 021696a5 2025-04-27.

When configuring with ns3 I get a CMake error:

-- Processing contrib/if77
CMake Error at build-support/custom-modules/ns3-module-macros.cmake:88 (add_library):
  add_library ALIAS requires exactly one target argument.
Call Stack (most recent call first):
  contrib/if77/CMakeLists.txt:8 (build_lib)

The file contrib/if77/CMakeLists.txt contains:

add_custom_target(
  if77
  COMMAND make
  WORKING_DIRECTORY lib
)

build_lib(
  LIBNAME IF77
  SOURCE_FILES
    model/if77-propagation-loss-model.cc
  HEADER_FILES
    model/if77-propagation-loss-model.h
  LIBRARIES_TO_LINK ${libpropagation}
      ${libcore}
    ${libif77}
  TEST_SOURCES
    test/if77-propagation-loss-model-test-suite.cc
)

I'm using CMake v3.23.1, but  the same error occurs if I back off to CMake v3.19 from 2021-04, the latest release at that time.

Ideas?

Thanks,
Peter

Gabriel Ferreira

unread,
Jun 30, 2025, 2:58:45 AM6/30/25
to ns-3-users
Hi Peter, 

add_custom_target and build_lib are creating conflicting if77 targets.
You must give if77 a different name to avoid that. E. G. If77lib.

Also, you cannot use ${libif77}, because its not a know target.
As such, you will get in uninitialized variable usage warning.
Since name will be conflicting, put if77.so/.a so we actually check
for the file. 
Reply all
Reply to author
Forward
0 new messages