[cmake-commits] king committed CMakeLists.txt NONE 1.1 testExe1.c NONE 1.1 testExe2.c NONE 1.1 testLib1.c NONE 1.1 testLib2.c NONE 1.1 testLib3.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/Export
In directory public:/mounts/ram/cvs-serv5446/Tests/ExportImport/Export

Added Files:
	CMakeLists.txt testExe1.c testExe2.c testLib1.c testLib2.c 
	testLib3.c 
Log Message:
ENH: Added ExportImport test to test new export/import features.


--- NEW FILE: testLib1.c ---
int testLib1() { return 0; }

--- NEW FILE: testExe1.c ---
#include <stdio.h>

int main(int argc, const char* argv[])
{
  if(argc < 2)
    {
    fprintf(stderr, "Must specify output file.\n");
    return 1;
    }
  {
  FILE* f = fopen(argv[1], "w");
  if(f)
    {
    fprintf(f, "int generated_by_testExe1() { return 0; }\n");
    fclose(f);
    }
  else
    {
    fprintf(stderr, "Error writing to %s\n", argv[1]);
    return 1;
    }
  }
  return 0;
}

--- NEW FILE: testLib3.c ---
#if defined(_WIN32) || defined(__CYGWIN__)
# define testLib3_EXPORT __declspec(dllexport)
#else
# define testLib3_EXPORT
#endif

testLib3_EXPORT int testLib3(void) { return 0; }

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

# We need ansi C support.
if(CMAKE_ANSI_CFLAGS)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
endif(CMAKE_ANSI_CFLAGS)

add_executable(testExe1 testExe1.c)

add_executable(testExe2 testExe2.c)
set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1)

add_library(testLib1 STATIC testLib1.c)
add_library(testLib2 STATIC testLib2.c)
target_link_libraries(testLib2 testLib1)

add_library(testLib3 SHARED testLib3.c)

# Install and export from install tree.
install(
  TARGETS testExe1 testLib1 testLib2 testExe2 testLib3
  EXPORT exp
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
  )
install(EXPORT exp NAMESPACE exp_ DESTINATION lib/exp)

# Export from build tree.
export(TARGETS testExe1 testLib1 testLib2 testExe2 testLib3
  NAMESPACE bld_
  FILE ExportBuildTree.cmake
  )

--- NEW FILE: testExe2.c ---
#if defined(_WIN32) || defined(__CYGWIN__)
# define testExe2_EXPORT __declspec(dllexport)
#else
# define testExe2_EXPORT
#endif

testExe2_EXPORT int testExe2Func(void) { return 123; }

int main()
{
  return 0;
}

--- NEW FILE: testLib2.c ---

extern int testLib1();

int testLib2() { return testLib1(); }



More information about the Cmake-commits mailing list