Dear experts,

I am trying to introduce OBJECT libraries into our project, 
http://www.diracprogram.org.<http://www.diracprogram.org>


Into local src/functionality1/CMakeLists.txt I changed


add_library(main ${local_sources})

                    to

add_library(main  OBJECT ${local_sources})


at  higher level, in src/CMakeLists.txt I changed


add_subdirectory(${PROJECT_SOURCE_DIR}/src/functionality1)
set(EXTERNAL_LIBS main ${EXTERNAL_LIBS})

                                   to

add_subdirectory(${PROJECT_SOURCE_DIR}/src/functionality1)
set(EXTERNAL_LIBS  $<TARGET_OBJECTS:main> ${EXTERNAL_LIBS})


and at the highest level of our CMake infrastructure I have linking of all 
object libraries for given  executable(s) :


 target_link_libraries( ${_executable}  ${EXTERNAL_LIBS}  )


However, during configuration I am getting repeating error messages  of type


"CMake Error at cmake/custom/core.cmake:75 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:main>

  The evaluation of the TARGET_OBJECTS generator expression is only suitable
  for consumption by CMake.  It is not suitable for writing out elsewhere.
Call Stack (most recent call first):
  CMakeLists.txt:77 (include)"


Any help please how to best arrange OBJECT libraries ? I have cmake version 
3.5.0 .


Yours, Miro

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to