[CMake] Custom Module
Gerry Weaver
gerryw at compvia.com
Tue Sep 29 06:25:18 EDT 2015
Hello All,
I'm trying to use a custom module, but I can't get cmake to see it. I am on FreeBSD 9.3 (amd64) using cmake-3.3.2. I have read and tried everything I can find on the topic. I have verified the module path via the "MESSAGE" command, but no joy. I have included all relevant information below. Any help would be much appreciated.
BTW: I also tried putting the .cmake files in the cmake Modules directory.
Thanks,
-S
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
MESSAGE( STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH} )
find_package(NIM)
FindNIM.cmake
---------------------
include(CMakeParseArguments)
find_program(NIM_EXECUTABLE nimrod PATHS ENV PATH)
mark_as_advanced(NIM_EXECUTABLE)
# Determine the valac version
if(NIM_EXECUTABLE)
execute_process(COMMAND ${NIM_EXECUTABLE} "--version"
OUTPUT_VARIABLE NIM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" NIM_VERSION ${NIM_VERSION})
endif(NIM_EXECUTABLE)
# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call
.
# set NIM_FOUND to TRUE if Nimrod has been found
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Nim
REQUIRED_VARS NIM_EXECUTABLE
VERSION_VAR NIM_VERSION)
set(NIM_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseNim.cmake")
UseNim.cmake
--------------------
include(CMakeParseArguments)
function(add_nim_executable )
cmake_parse_arguments(ARGS "" "TARGET" "SOURCES" ${ARGN})
# collect set of input source files
set(in_files "")
foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
endforeach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
# set the target binary and nim cache directory
set(nim_target "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_TARGET}")
set(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/nimcache")
# add target to trigger the nimrod compiler
add_custom_target(
nim ALL
COMMAND
${NIM_EXECUTABLE} "c" "--nimcache:" ${DIRECTORY} "--out:" ${nim_
target} ${in_files}
DEPENDS
${in_files}
endfunction(add_nim_executable)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150929/a36335fd/attachment.html>
More information about the CMake
mailing list