[Cmake-commits] [cmake-commits] king committed CMakeLists.txt NONE 1.1 LinkLanguage.c NONE 1.1 foo.cxx NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Jul 10 13:53:41 EDT 2009


Update of /cvsroot/CMake/CMake/Tests/LinkLanguage
In directory public:/mounts/ram/cvs-serv18114/Tests/LinkLanguage

Added Files:
	CMakeLists.txt LinkLanguage.c foo.cxx 
Log Message:
ENH: Test transitive link languages

This test creates a C executable that links to a C++ static library.  On
most platforms the executable will not link unless the C++ linker is
chosen correctly.


--- NEW FILE: LinkLanguage.c ---
extern int foo(void);
int main()
{
  return foo();
}


--- NEW FILE: CMakeLists.txt ---
cmake_minimum_required(VERSION 2.7.20090708)
project(LinkLanguage C CXX)

add_library(foo STATIC foo.cxx)
add_executable(LinkLanguage LinkLanguage.c)
target_link_libraries(LinkLanguage foo)

# CMake should now automatically choose CXX for linking, so we need
# not set the property:
#set_property(TARGET LinkLanguage PROPERTY LINKER_LANGUAGE CXX)

--- NEW FILE: foo.cxx ---
extern "C" int foo(void)
{
  // Reference C++ standard library symbols.
  delete new int;
  return 0;
}



More information about the Cmake-commits mailing list