Commit ae912fc8 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - once again changed target directory for modules as windows simply...

[CHANGE] - once again changed target directory for modules as windows simply is stupid. Module filenames now get prefixed and copied to the runtime/lib directories (on Windows this is bin, Unix uses ../lib).
parent 1d84aa09
......@@ -15,6 +15,11 @@ TARGET_LINK_LIBRARIES( common ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} )
# with these defines.
add_definitions( '-DW_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}"' )
add_definitions( '-DW_LIB_SUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}"' )
IF( CMAKE_HOST_WIN32 )
add_definitions( '-DW_LIB_PATH="."' ) # use relative paths here
ELSE()
add_definitions( '-DW_LIB_PATH="../lib"' )
ENDIF()
# Unit tests
IF( OW_COMPILE_TESTS )
......
......@@ -274,3 +274,8 @@ std::string WSharedLib::getSystemSuffix()
return W_LIB_SUFFIX;
}
std::string WSharedLib::getSystemLibPath()
{
return W_LIB_PATH;
}
......@@ -124,6 +124,14 @@ public:
*/
static std::string getSystemSuffix();
/**
* Returns the default path for libraries on the current system. This is the directory where to search for .so,.dll or .dylib files. On Unix,
* this will be "../lib", on Windows ".".
*
* \return the path on the system.
*/
static std::string getSystemLibPath();
protected:
private:
......
......@@ -35,7 +35,7 @@ WModuleLoader::WModuleLoader( ):
m_path( "." )
{
// initialize members
std::string libPath = "../lib/modules";
std::string libPath = WSharedLib::getSystemLibPath();
WPreferences::getPreference( "modules.path", &libPath );
m_path = boost::filesystem::path( libPath );
}
......@@ -51,12 +51,18 @@ void WModuleLoader::load( WSharedAssociativeContainer< std::set< boost::shared_p
// iterate module directory, look for .so,.dll,.dylib files
WAssert( boost::filesystem::exists( m_path ), "" );
WLogger::getLogger()->addLogMessage( "Searching modules in \"" + m_path.file_string() + "\" with prefix \"" + getModulePrefix() + "\".",
"Module Loader", LL_INFO );
for( boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator( m_path );
i != boost::filesystem::directory_iterator(); ++i )
{
// all modules need to begin with this
std::string suffix = wiotools::getSuffix( i->leaf() );
if( !boost::filesystem::is_directory( *i ) && ( suffix == WSharedLib::getSystemSuffix() ) )
std::string stem = i->path().stem();
if( !boost::filesystem::is_directory( *i ) && ( suffix == WSharedLib::getSystemSuffix() ) &&
( stem.compare( 0, getModulePrefix().length(), getModulePrefix() ) == 0 ) )
{
try
{
......@@ -95,3 +101,10 @@ void WModuleLoader::load( WSharedAssociativeContainer< std::set< boost::shared_p
}
}
}
std::string WModuleLoader::getModulePrefix()
{
// all module file names need to have this prefix:
return WSharedLib::getSystemPrefix() + "module_";
}
......@@ -61,6 +61,13 @@ public:
*/
void load( WSharedAssociativeContainer< std::set< boost::shared_ptr< WModule > > >::WriteTicket ticket );
/**
* Returns the prefix of a shared module library filename.
*
* \return the prefix.
*/
static std::string getModulePrefix();
private:
/**
......
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/modules )
GET_FILENAME_COMPONENT( modname ${CMAKE_CURRENT_SOURCE_DIR} NAME )
ADD_LIBRARY( ${modname} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${modname} kernel )
INSTALL( TARGETS ${modname} LIBRARY DESTINATION lib/modules ARCHIVE DESTINATION lib/modules )
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_NAME "module_${MODULE_NAME}" ) # prefix all module names with "module_" to separate them from other libs
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} kernel )
# Unit tests
IF( OW_COMPILE_TESTS )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"kernel;${modname}"
"kernel;${MODULE_NAME}"
)
ENDIF( OW_COMPILE_TESTS )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment