[Cmake-commits] [cmake-commits] hoffman committed CMakeLists.txt NONE 1.1.2.2 imp_lib1.c NONE 1.1.2.2 imp_mod1.c NONE 1.1.2.2 imp_testExe1.c NONE 1.1.2.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Apr 7 15:32:12 EDT 2009
Update of /cvsroot/CMake/CMake/Tests/ExportImport/Import/A
In directory public:/mounts/ram/cvs-serv29663/Tests/ExportImport/Import/A
Added Files:
Tag: CMake-2-6
CMakeLists.txt imp_lib1.c imp_mod1.c imp_testExe1.c
Log Message:
ENH: merge in changes for RC 4
--- 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);
testExe2_IMPORT int testExe2lib(void);
int imp_mod1()
{
return testExe2Func() + testExe2lib();
}
--- NEW FILE: CMakeLists.txt ---
# 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)
# Create a library to be linked by another directory in this project
# to test transitive linking to otherwise invisible imported targets.
add_library(imp_lib1 STATIC imp_lib1.c)
target_link_libraries(imp_lib1 exp_testLib2)
add_library(imp_lib1b STATIC imp_lib1.c)
target_link_libraries(imp_lib1b bld_testLib2)
--- NEW FILE: imp_testExe1.c ---
extern int generated_by_testExe1();
extern int generated_by_testExe3();
extern int testLib2();
extern int testLib3();
extern int testLib4();
extern int testLib4lib();
/* Switch a symbol between debug and optimized builds to make sure the
proper library is found from the testLib4 link interface. */
#ifdef EXE_DBG
# define testLib4libcfg testLib4libdbg
#else
# define testLib4libcfg testLib4libopt
#endif
extern testLib4libcfg(void);
int main()
{
return (testLib2() + generated_by_testExe1() + testLib3() + testLib4()
+ generated_by_testExe3() + testLib4lib() + testLib4libcfg());
}
--- NEW FILE: imp_lib1.c ---
extern int testLib2(void);
int imp_lib1(void)
{
return testLib2();
}
More information about the Cmake-commits
mailing list