[cmake-commits] king committed CMakeLists.txt NONE 1.1 imp_mod1.c NONE 1.1 imp_testExe1.c NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jan 28 08:40:23 EST 2008


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

Added Files:
	CMakeLists.txt imp_mod1.c imp_testExe1.c 
Log Message:
ENH: Added ExportImport test to test new export/import features.


--- NEW FILE: imp_mod1.c ---
#if defined(_WIN32) || defined(__CYGWIN__)
# define testExe2_IMPORT __declspec(dllimport)
#else
# define testExe2_IMPORT
#endif

testExe2_IMPORT int testExe2Func(void);

int imp_mod1()
{
  return testExe2Func();
}

--- NEW FILE: imp_testExe1.c ---
extern int generated_by_testExe1();
extern int testLib2();
extern int testLib3();

int main()
{
  return testLib2() + generated_by_testExe1() + testLib3();
}

--- NEW FILE: CMakeLists.txt ---
project(Import C)

# We need ansi C support.
if(CMAKE_ANSI_CFLAGS)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
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_executable(imp_testExe1
  imp_testExe1.c
  ${Import_BINARY_DIR}/exp_generated.c
  )

# Try linking to a library imported from the install tree.
target_link_libraries(imp_testExe1 exp_testLib2 exp_testLib3)

# 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_executable(imp_testExe1b
  imp_testExe1.c
  ${Import_BINARY_DIR}/bld_generated.c
  )

# Try linking to a library imported from the build tree.
target_link_libraries(imp_testExe1b bld_testLib2 bld_testLib3)

# 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)



More information about the Cmake-commits mailing list