add platform check for how to link to the standard math library.

This allows to support QNX.
This commit is contained in:
Benoit Jacob
2010-04-19 11:19:22 -04:00
parent 40b2aaa8b1
commit 84d1b2ae3a
9 changed files with 163 additions and 40 deletions

View File

@@ -1,17 +1,20 @@
FILE(GLOB examples_SRCS "*.cpp")
file(GLOB examples_SRCS "*.cpp")
ADD_CUSTOM_TARGET(all_examples)
add_custom_target(all_examples)
FOREACH(example_src ${examples_SRCS})
GET_FILENAME_COMPONENT(example ${example_src} NAME_WE)
ADD_EXECUTABLE(${example} ${example_src})
GET_TARGET_PROPERTY(example_executable
${example} LOCATION)
ADD_CUSTOM_COMMAND(
TARGET ${example}
POST_BUILD
COMMAND ${example_executable}
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out
)
ADD_DEPENDENCIES(all_examples ${example})
ENDFOREACH(example_src)
foreach(example_src ${examples_SRCS})
get_filename_component(example ${example_src} NAME_WE)
add_executable(${example} ${example_src})
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
target_link_libraries(${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
endif()
get_target_property(example_executable
${example} LOCATION)
add_custom_command(
TARGET ${example}
POST_BUILD
COMMAND ${example_executable}
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out
)
add_dependencies(all_examples ${example})
endforeach(example_src)

View File

@@ -1,25 +1,28 @@
FILE(GLOB snippets_SRCS "*.cpp")
file(GLOB snippets_SRCS "*.cpp")
ADD_CUSTOM_TARGET(all_snippets)
add_custom_target(all_snippets)
FOREACH(snippet_src ${snippets_SRCS})
GET_FILENAME_COMPONENT(snippet ${snippet_src} NAME_WE)
SET(compile_snippet_target compile_${snippet})
SET(compile_snippet_src ${compile_snippet_target}.cpp)
FILE(READ ${snippet_src} snippet_source_code)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
foreach(snippet_src ${snippets_SRCS})
get_filename_component(snippet ${snippet_src} NAME_WE)
set(compile_snippet_target compile_${snippet})
set(compile_snippet_src ${compile_snippet_target}.cpp)
file(READ ${snippet_src} snippet_source_code)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
ADD_EXECUTABLE(${compile_snippet_target}
add_executable(${compile_snippet_target}
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
GET_TARGET_PROPERTY(compile_snippet_executable
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
endif()
get_target_property(compile_snippet_executable
${compile_snippet_target} LOCATION)
ADD_CUSTOM_COMMAND(
add_custom_command(
TARGET ${compile_snippet_target}
POST_BUILD
COMMAND ${compile_snippet_executable}
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
)
ADD_DEPENDENCIES(all_snippets ${compile_snippet_target})
add_dependencies(all_snippets ${compile_snippet_target})
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
PROPERTIES OBJECT_DEPENDS ${snippet_src})
ENDFOREACH(snippet_src)
endforeach(snippet_src)