[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.6 1.7 imp_mod1.c 1.2 NONE imp_testExe1.c 1.4 NONE imp_testTransExe1.c NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Apr 6 11:11:35 EDT 2009


Update of /cvsroot/CMake/CMake/Tests/ExportImport/Import
In directory public:/mounts/ram/cvs-serv2904/Tests/ExportImport/Import

Modified Files:
	CMakeLists.txt 
Added Files:
	imp_testTransExe1.c 
Removed Files:
	imp_mod1.c imp_testExe1.c 
Log Message:
ENH: Test transitive link to subdir-imported lib

This tests linking to an imported target that is not visible but is a
transitive dependency of a target that is visible.  See issue #8843.


--- imp_mod1.c DELETED ---

--- NEW FILE: imp_testTransExe1.c ---
extern int imp_lib1(void);

int main()
{
  return imp_lib1();
}

--- imp_testExe1.c DELETED ---

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/ExportImport/Import/CMakeLists.txt,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** CMakeLists.txt	4 Sep 2008 21:34:25 -0000	1.6
--- CMakeLists.txt	6 Apr 2009 15:11:15 -0000	1.7
***************
*** 7,70 ****
  endif(CMAKE_ANSI_CFLAGS)
  
! # Import targets from the exported build tree.
! include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake)
! 
! # Import targets from the exported install tree.
! include(${CMAKE_INSTALL_PREFIX}/lib/exp/exp.cmake)
! 
! # Try referencing an executable imported from the install tree.
! add_custom_command(
!   OUTPUT ${Import_BINARY_DIR}/exp_generated.c
!   COMMAND exp_testExe1 ${Import_BINARY_DIR}/exp_generated.c
!   DEPENDS exp_testExe1
!   )
! add_custom_command(
!   OUTPUT ${Import_BINARY_DIR}/exp_generated3.c
!   COMMAND exp_testExe3 ${Import_BINARY_DIR}/exp_generated3.c
!   DEPENDS exp_testExe3
!   )
! 
! add_executable(imp_testExe1
!   imp_testExe1.c
!   ${Import_BINARY_DIR}/exp_generated.c
!   ${Import_BINARY_DIR}/exp_generated3.c
!   )
! 
! # Try linking to a library imported from the install tree.
! target_link_libraries(imp_testExe1 exp_testLib2 exp_testLib3 exp_testLib4)
! 
! # Try building a plugin to an executable imported from the install tree.
! add_library(imp_mod1 MODULE imp_mod1.c)
! target_link_libraries(imp_mod1 exp_testExe2)
! 
! # Try referencing an executable imported from the build tree.
! add_custom_command(
!   OUTPUT ${Import_BINARY_DIR}/bld_generated.c
!   COMMAND bld_testExe1 ${Import_BINARY_DIR}/bld_generated.c
!   DEPENDS bld_testExe1
!   )
! add_custom_command(
!   OUTPUT ${Import_BINARY_DIR}/bld_generated3.c
!   COMMAND bld_testExe3 ${Import_BINARY_DIR}/bld_generated3.c
!   DEPENDS bld_testExe3
!   )
! 
! add_executable(imp_testExe1b
!   imp_testExe1.c
!   ${Import_BINARY_DIR}/bld_generated.c
!   ${Import_BINARY_DIR}/bld_generated3.c
!   )
! 
! # Try linking to a library imported from the build tree.
! target_link_libraries(imp_testExe1b bld_testLib2 bld_testLib3 bld_testLib4)
  
! # Try building a plugin to an executable imported from the build tree.
! add_library(imp_mod1b MODULE imp_mod1.c)
! target_link_libraries(imp_mod1b bld_testExe2)
  
! # Export/CMakeLists.txt pretends the RelWithDebInfo (as well as Debug)
! # configuration should link to debug libs.
! foreach(c DEBUG RELWITHDEBINFO)
!   set_property(TARGET imp_testExe1 PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG)
!   set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG)
! endforeach(c)
--- 7,24 ----
  endif(CMAKE_ANSI_CFLAGS)
  
! # Import everything in a subdirectory.
! add_subdirectory(A)
  
! # Make sure the imported targets are scoped inside the subdirectory.
! if(TARGET exp_testLib2)
!   message(FATAL_ERROR "Imported target exp_testLib2 is not scoped in subdir!")
! endif()
! if(TARGET bld_testLib2)
!   message(FATAL_ERROR "Imported target bld_testLib2 is not scoped in subdir!")
! endif()
  
! # Test transitive linking to a target imported in the subdirectory.
! add_executable(imp_testTransExe1 imp_testTransExe1.c)
! target_link_libraries(imp_testTransExe1 imp_lib1)
! add_executable(imp_testTransExe1b imp_testTransExe1.c)
! target_link_libraries(imp_testTransExe1b imp_lib1b)



More information about the Cmake-commits mailing list