CMakeLists.txt 1.68 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
cmake_minimum_required(VERSION 2.8.12)
#find_package (EXPAT)
#find_package (NetCDF)
project(myexecutable)
# Set source directory
#set(SOURCE_DIR "molfile")

# Tell CMake that headers are also in SOURCE_DIR
#include_directories(${SOURCE_DIR} "${SOURCE_DIR}/vmd_molfile_plugin/molfile_plugin/include" "${SOURCE_DIR}/vmd_molfile_plugin/molfile_plugin/lib")

#set(SOURCES "${SOURCE_DIR}/libpymolfile_wrap.cxx" "${SOURCE_DIR}/pymolfile.c" "${SOURCE_DIR}/lib/libmolfile_plugin.a")

set(TARGET_ARCH_REGEX "^.*-march[= ]([^ ]+).*$")
string(REGEX MATCH "${TARGET_ARCH_REGEX}" TARGET_ARCH_MATCH "${CMAKE_C_FLAGS}" "${CMAKE_CXX_FLAGS}")
if (TARGET_ARCH_MATCH)
    string(REGEX REPLACE "${TARGET_ARCH_REGEX}" "\\1" TARGET_ARCH "${CMAKE_C_FLAGS}" "${CMAKE_CXX_FLAGS}")
else()
    set(TARGET_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
message(TARGET_ARCH= ${TARGET_ARCH})
message(OSX= ${OSX_ARCHITECTURES})
message(OSX= ${CMAKE_OSX_ARCHITECTURES})
message(SYS_VER= ${CMAKE_SYSTEM_VERSION})
message(SYS_NAME= ${CMAKE_SYSTEM_NAME})
message(SYS_PROC= ${CMAKE_SYSTEM_PROCESSOR})
message(SYS= ${CMAKE_SYSTEM})
message(TARGET_ARCH_REGEX= ${TARGET_ARCH_REGEX})
message(TARGET_ARCH_MATCH= ${TARGET_ARCH_MATCH})

add_custom_command( 
    OUTPUT vmd_molfile_plugins/compile/lib_MACOSXX86_64GCC/molfile/libmolfile_plugins.a 
    COMMAND make MACOSXX86_64GCCTNG
    WORKING_DIRECTORY vmd_molfile_plugins
) 
add_custom_target( 
    libmolfile_plugins.a 
    COMMAND make MACOSXX86_64GCCTNG
    WORKING_DIRECTORY vmd_molfile_plugins
)
#add_executable(myexecutable myexcutable.c)
#target_link_libraries(myexecutable vmd_molfile_plugins/compile/lib_MACOSXX86_64GCCTNG/molfile/libmolfile_plugins.a) 
#add_dependencies(myexecutable extern_lib)