[CMake] simple program, os x library archive error, linux no issues

jmerkow jmerkow at gmail.com
Mon Nov 11 16:02:53 EST 2013


Hello

I am developing a few simple programs that use ITK/VTK.  I am making a few
image filters for ITK and I have some test .cxx files to test them out. 
This process is going smoothly except that 'make' returns an error when I
use it on OS X.

here is the error:
Scanning dependencies of target LevelSetNormals
Linking CXX static library libLevelSetNormals.a
ar: no archive members specified
usage:  ar -d [-TLsv] archive file ...
	ar -m [-TLsv] archive file ...
....
make[2]: *** [lib/libLevelSetNormals.a] Error 1
make[1]: *** [lib/CMakeFiles/LevelSetNormals.dir/all] Error 2
make: *** [all] Error 2

./src/CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project(itkNormals)
FIND_PACKAGE (ITK REQUIRED)
IF( ITK_FOUND )
  include( ${ITK_USE_FILE} )
ENDIF( ITK_FOUND )

add_subdirectory(test)
add_subdirectory(lib)


./src/test/CMakeLists.txt:

include_directories(${PROJECT_SOURCE_DIR}/lib)

add_executable(itkNormalsMain itkNormals.cxx)
TARGET_LINK_LIBRARIES(itkNormalsMain ${ITK_LIBRARIES})
#TARGET_LINK_LIBRARIES(itkNormalsMain ImageFilter)
#TARGET_LINK_LIBRARIES(itkNormalsMain DotImageFilter)

#itkDotNormals.cxx
add_executable(dotImageTest itkDotNormals.cxx)
TARGET_LINK_LIBRARIES(dotImageTest ${ITK_LIBRARIES})
#TARGET_LINK_LIBRARIES(dotImageTest ImageFilter)
TARGET_LINK_LIBRARIES(dotImageTest DotImageFilter)

add_executable(dotTest DotProductImageFilterTest.cxx)
TARGET_LINK_LIBRARIES(dotTest ${ITK_LIBRARIES})
TARGET_LINK_LIBRARIES(dotTest ImageFilter)
TARGET_LINK_LIBRARIES(dotTest DotImageFilter)
TARGET_LINK_LIBRARIES(dotTest Utils)

add_executable(LST LevelSetTest.cxx)
TARGET_LINK_LIBRARIES(LST ${ITK_LIBRARIES})
TARGET_LINK_LIBRARIES(LST ImageFilter)
TARGET_LINK_LIBRARIES(LST DotImageFilter)
TARGET_LINK_LIBRARIES(LST LevelSetNormals)


./src/lib/CMakeLists.txt

add_library(DotImageFilter itkDotImageFilter.h)
SET_TARGET_PROPERTIES(DotImageFilter PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(DotImageFilter ${ITK_LIBRARIES})

add_library(ImageFilter itkImageFilter.h)
SET_TARGET_PROPERTIES(ImageFilter PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(ImageFilter ${ITK_LIBRARIES})

add_library(Utils utils.hxx)
SET_TARGET_PROPERTIES(Utils PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(Utils ${ITK_LIBRARIES})

add_library(LevelSetNormals itkLevelSetNormals.h)
SET_TARGET_PROPERTIES(LevelSetNormals PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(LevelSetNormals ${ITK_LIBRARIES})



--
View this message in context: http://cmake.3232098.n2.nabble.com/simple-program-os-x-library-archive-error-linux-no-issues-tp7586040.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list