[CMake] Fwd: Problem finding DLLS to use with tests

Stephen Torri stephen.torri at gmail.com
Thu Jun 23 14:18:33 EDT 2011


 On Thu, Jun 23, 2011 at 11:37 AM, <aaron.meadows at thomsonreuters.com> wrote:

>  Can you post your CMakeLists.txt?  Did you get different errors for each
> of the 3 solutions you tried, or were they all the same error?  What was the
> exception code?
>

I got the same error. I did not receive a exception throw when I ran the
testing code via Visual Studio. I got a message that said:

"The application has failed to start because
boost_unit_test_framework-vc100-mt-gd-1_46_1.dll was not found. Reinstalling
the application may fix the problem".

It looks like I either need to copy the boost dlls I use to my test
directory or somehow add the boost directory to the PATH environment
variable.

---------- Master CMakeLists.txt ------------
cmake_minimum_required ( VERSION 2.8 )
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
PROJECT(myproject)
SET ( ${PROJECT_NAME}_MAJOR_VERSION 0 )
SET ( ${PROJECT_NAME}_MINOR_VERSION 5 )
SET ( ${PROJECT_NAME}_PATCH_LEVEL 0 )
SET(BOOST_ROOT "C:/Program Files (x86)/boost/boost_1_46_1" CACHE PATH
"Installation directory for boost")
#-----------------------------------------------------
#                   DEBUG
#-----------------------------------------------------
OPTION(DEBUG_TLE_PARSER "Enable debugging of TLE parser." OFF)
IF(DEBUG_TLE_PARSER)
  SET (DEBUG_PARSER 1)
ENDIF(DEBUG_TLE_PARSER)
#-----------------------------------------------------
#            Unix Configuration
#-----------------------------------------------------
IF(UNIX)

  SET(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for
executables")
  SET(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
  SET(INSTALL_INC_DIR include CACHE PATH "Installation directory for
headers")
  SET(INSTALL_DATA_DIR shared/${PROJECT_NAME} CACHE PATH "Installation
directory for data files")

  #-----------------------------------------------------
  #                 FLAGS
  #----------------------------------------------------
  IF(CMAKE_BUILD_TYPE MATCHES Release)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall -Werror -ansi
-pedantic")
  ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
  IF(CMAKE_BUILD_TYPE MATCHES Debug)
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -Wall -Werror
-ansi -pedantic")
  ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)

  OPTION(BUILD_SHARED_LIBS "Build shared libraries." ON)

  IF(DEBUG_TLE_PARSER)
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG_PARSER")
  ENDIF(DEBUG_TLE_PARSER)
ENDIF(UNIX)
set(myproject_SRC_DIR ${CMAKE_SOURCE_DIR}/myproject)
#-----------------------------------------------------
#                 SHARED / STATIC
#-----------------------------------------------------
# Allow the developer to select if Dynamic or Static libraries are built
OPTION(BUILD_SHARED_LIBS "Build shared libraries." OFF)
# Set the LIB_TYPE variable to STATIC
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
  # User wants to build Dynamic Libraries, so change the LIB_TYPE variable
to CMake keyword 'SHARED'
  SET (LIB_TYPE SHARED)
  IF(WIN32)
    SET (BUILD_SHARED_WIN32 1)
  ENDIF(WIN32)
ENDIF (BUILD_SHARED_LIBS)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/myproject/config.h.in${CMAKE_CURRENT_SOURCE_DIR}/myproject/config.h)
#-----------------------------------------------------
#                   TESTING
#-----------------------------------------------------
ENABLE_TESTING()
add_custom_target ( check COMMAND ${CMAKE_CTEST_COMMAND} )
SUBDIRS(Testing/units)
SUBDIRS(Testing/myproject)

#-----------------------------------------------------
#                 FIND PACKAGES
#-----------------------------------------------------
IF(WIN32)
   SET(Boost_USE_STATIC_LIBS ON)
   SET(Boost_USE_MULTITHREADED ON)
ENDIF(WIN32)
SET(Boost_ADDITIONAL_VERSIONS "1.46" "1.44" "1.44.0" )
FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options thread
unit_test_framework filesystem system)
#-----------------------------------------------------
#                   CPACK
#-----------------------------------------------------
#-----------------------------
#   CPACK DESCRIPTION INFORMATION
#-----------------------------
IF(CMAKE_BUILD_TYPE MATCHES Release)
SET(CPACK_PACKAGE_NAME "myproject")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "myproject")
ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
IF(CMAKE_BUILD_TYPE MATCHES Debug)
SET(CPACK_PACKAGE_NAME "myproject_debug")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "myproject debug")
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)

SET(CPACK_PACKAGE_VENDOR "Self")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "myproject is an implementation of the
myproject satellite model for use in the DTCS project")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR ${myproject_MAJOR_VERSION})
SET(CPACK_PACKAGE_VERSION_MINOR ${myproject_MINOR_VERSION})
SET(CPACK_PACKAGE_VERSION_PATCH ${myproject_PATCH_LEVEL})
#-----------------------------------------------------
#                 DOCUMENTATION
#-----------------------------------------------------
find_package ( Doxygen )
IF(DOXYGEN)
   ADD_SUBDIRECTORY(documentation)
ELSE(DOXYGEN)
   MESSAGE(STATUS "WARNING: Doxygen not found - API documentation not
created")
ENDIF(DOXYGEN)
SET ( INSTALLED_HEADERS
     myproject/constants.hpp
  myproject/dll_defines.hpp
     myproject/exception.hpp
     myproject/file_error.hpp
     myproject/interface.hpp
     myproject/missing_file_error.hpp
  myproject/exception.hpp
     myproject/parsing_error.hpp )

SET ( INSTALLED_UNIT_HEADERS
     myproject/units/coordinates.hpp
  myproject/units/day.hpp
  myproject/units/invalid_day_exception.hpp
  myproject/units/invalid_hour_exception.hpp
  myproject/units/invalid_month_exception.hpp
  myproject/units/invalid_year_exception.hpp
     myproject/units/julian.hpp
  myproject/units/minute.hpp
  myproject/units/month.hpp
  myproject/units/second.hpp
  myproject/units/time.hpp
     myproject/units/value_array.hpp
     myproject/units/vector.hpp
  myproject/units/year.hpp )

SET ( HEADERS
  ${INSTALLED_HEADERS}
  ${INSTALLED_UNIT_HEADERS}
     myproject/interface_impl.hpp
     myproject/model_map.hpp
     myproject/model_map.inl
     myproject/satellite_model.hpp
  myproject/parsers/bstar_compose.hpp
  myproject/parsers/degree_to_radians_convert.hpp
  myproject/parsers/derivative_compose.hpp
  myproject/parsers/eccentricity_compose.hpp
  myproject/parsers/error_handler.hpp
  myproject/parsers/mean_motion_compose.hpp
  myproject/parsers/myproject_entry_compose.hpp
  myproject/parsers/tle_parser.hpp
  myproject/parsers/ureal11_policy.hpp
     myproject/model/near_earth_orbit.hpp
     myproject/model/near_earth_orbit.inl
     myproject/model/myproject.hpp
     myproject/model/myproject.inl
     myproject/model/myproject_orbit_data.hpp
     myproject/model/myproject_orbit_data.inl
     myproject/units/tle.hpp
     myproject/world_geodetic_system/gravitational_constant_t.hpp
     myproject/world_geodetic_system/old_wsg72_constant_type.hpp
     myproject/world_geodetic_system/no_constants_type.hpp
     myproject/world_geodetic_system/j2_constant_type.hpp
     myproject/world_geodetic_system/j2j3_constant_type.hpp
     myproject/world_geodetic_system/wsg72_constant_type.hpp
     myproject/world_geodetic_system/wsg84_constant_type.hpp )

SET ( SOURCE
    myproject/interface.cpp
    myproject/model/near_earth_orbit.cpp
    myproject/model/myproject.cpp
    myproject/model/myproject_orbit_data.cpp
 myproject/units/day.cpp
 myproject/units/hour.cpp
    myproject/units/julian.cpp
 myproject/units/minute.cpp
 myproject/units/month.cpp
 myproject/units/second.cpp
    myproject/units/tle.cpp
 myproject/units/value_array.cpp
 myproject/units/vector.cpp
 myproject/units/year.cpp
    myproject/world_geodetic_system/old_wsg72_constant_type.cpp
    myproject/world_geodetic_system/no_constants_type.cpp
    myproject/world_geodetic_system/J2_constant_type.cpp
    myproject/world_geodetic_system/J2J3_constant_type.cpp
    myproject/world_geodetic_system/wsg72_constant_type.cpp
    myproject/world_geodetic_system/wsg84_constant_type.cpp )
#SET ( CSHARP_SOURCE
#  csharp/myproject_wrap.cxx )
#
#FILE ( GLOB CSHARP_FILES "csharp/*.cs" )

#-----------------------------------------------------
#                   LINKING
#-----------------------------------------------------
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}
${myproject_SRC_DIR})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
add_library ( myproject ${LIB_TYPE} ${SOURCE} ${HEADERS} )
IF(UNIX)
target_link_libraries ( myproject stdc++ )
ENDIF(UNIX)
#add_library ( myproject_csharp ${CSHARP_SOURCE} )
add_executable(testcpp myproject/testcpp.cpp )
add_executable(validate myproject/validate.cpp )

IF(UNIX)
target_link_libraries (validate ${Boost_LIBRARIES} myproject pthread )
target_link_libraries (testcpp ${Boost_LIBRARIES} myproject pthread )
ELSE(WIN32)
target_link_libraries (validate ${Boost_LIBRARIES} myproject )
target_link_libraries (testcpp ${Boost_LIBRARIES} myproject )
ENDIF(UNIX)

#-----------------------------------------------------
#                   INSTALL
#-----------------------------------------------------
INSTALL(TARGETS myproject DESTINATION lib COMPONENT libraries)
INSTALL(FILES ${INSTALLED_HEADERS} DESTINATION include/${PROJECT_NAME}
COMPONENT devel)
INSTALL(FILES ${INSTALLED_UNIT_HEADERS} DESTINATION
include/${PROJECT_NAME}/units COMPONENT devel)
#INSTALL(TARGETS myproject_csharp DESTINATION lib COMPONENT csharp)
#INSTALL(FILES ${CSHARP_FILES} DESTINATION include/${PROJECT_NAME}/csharp
COMPONENT csharp)

IF(UNIX)
  INSTALL(FILES Findmyproject.cmake DESTINATION share/module)
ENDIF(UNIX)

#-----------------------------
#  INSTALLATION INFORMATION
#-----------------------------
#SET(CPACK_COMPONENTS_ALL libraries devel docs csharp)
SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic library used to build
programs with myproject Interface")
SET(CPACK_COMPONENT_DEVEL_DISPLAY_NAME "C++ Headers")
SET(CPACK_COMPONENT_DEVEL_DESCRIPTION "C++ header files for use with
myproject Interface")
SET(CPACK_COMPONENT_DEVEL_DEPENDS libraries)
SET(CPACK_COMPONENT_DOCS_DISPLAY_NAME "C++ API Documentation")
SET(CPACK_COMPONENT_DOCS_DESCRIPTION "C++ API HTML files describing the API
for myproject Interface")
#SET(CPACK_COMPONENT_CSHARP_DISPLAY_NAME "C# API files")
#SET(CPACK_COMPONENT_CSHARP_DESCRIPTION "C# API files describing the API for
myproject Interface")
SET(CPACK_COMPONENT_LIBRARIES_GROUP "Runtime")
SET(CPACK_COMPONENT_DEVEL_GROUP "Development")
SET(CPACK_COMPONENT_DOCS_GROUP "Development")
#SET(CPACK_COMPONENT_CSHARP_GROUP "Development")
SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "All of the tools
necessary to develop against the SMT Interface")

#-----------------------------
#  INSTALLATION TYPES
#-----------------------------
SET(CPACK_ALL_INSTALL_TYPES Full Runtime Developer)
SET(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Full Developer Runtime)
SET(CPACK_COMPONENT_DEVEL_INSTALL_TYPES Full Developer)
SET(CPACK_COMPONENT_DOCS_INSTALL_TYPES Full Developer)
#SET(CPACK_COMPONENT_CSHARP_INSTALL_TYPES Full Developer)
IF (WIN32)
  SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\InstallIcon.bmp")
  SET(CPACK_NSIS_MODIFY_PATH ON)
  SET(CPACK_GENERATOR "NSIS")
ELSE (UNIX)
  SET(CPACK_GENERATOR "RPM")
ENDIF(WIN32)
# Always include this last.
INCLUDE(CPack)

--------- test CMakeLists.txt -------------
add_executable ( test_julian EXCLUDE_FROM_ALL test_julian.cpp )
add_test ( test_julian test_julian )
add_dependencies ( check test_julian )
target_link_libraries ( test_julian ${Boost_LIBRARIES} myproject )

add_executable ( test_valuearray EXCLUDE_FROM_ALL test_valuearray.cpp )
add_test ( test_valuearray test_valuearray )
add_dependencies ( check test_valuearray )
target_link_libraries ( test_valuearray ${Boost_LIBRARIES} myproject )

add_executable ( test_vector EXCLUDE_FROM_ALL test_vector.cpp )
add_test ( test_vector test_vector )
add_dependencies ( check test_vector )
target_link_libraries ( test_vector ${Boost_LIBRARIES} myproject )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110623/b2e1758e/attachment-0001.htm>


More information about the CMake mailing list